picolisp-gtk-server

picoLisp gtk-server interface
git clone https://logand.com/git/picolisp-gtk-server.git/
Log | Files | Refs

gtk-example.l (850B)


      1 # picoLisp + gtk-server example
      2 # 26feb2009 Tomas Hlavaty
      3 # $ ~/picolisp/p gtk-example.l -bye
      4 # requires http://logand.com/gtk/gtk.l
      5 
      6 (load "gtk.l")
      7 
      8 (gtk_init 'NULL 'NULL)
      9 (setq W (gtk_window_new 0))
     10 (gtk_window_set_title W "This is a title")
     11 (gtk_window_set_default_size W 100 100)
     12 (gtk_window_set_position W 1)
     13 (setq G (gtk_table_new 30 30 1))
     14 (gtk_container_add W G)
     15 (setq B1 (gtk_button_new_with_label "Exit"))
     16 (gtk_table_attach_defaults G B1 17 28 20 25)
     17 (setq B2 (gtk_button_new_with_label "Print text"))
     18 (gtk_table_attach_defaults G B2 2 13 20 25)
     19 (setq E (gtk_entry_new))
     20 (gtk_table_attach_defaults G E 2 28 5 15)
     21 (gtk_widget_show_all W)
     22 (let V 0
     23    (until (prog
     24              (setq V (gtk_server_callback 'wait))
     25              (or (= V B1) (= V W)) )
     26      (when (= V B2)
     27         (prinl "Contents: " (gtk_entry_get_text E)) ) ) )
     28 (gtk_exit 0)