Phix and GTK test#1

new topic     » topic index » view thread      » older message » newer message

https://i.imgur.com/KHkgDj4.png

without warning 
include GtkMain.e 
include GtkWindow.e 
include GtkBox.e 
include GtkPaned.e 
include GtkLabel.e 
include GtkTextView.e 
include GtkButtonBox.e 
include GtkButton.e 
 
Window win = new()   
 win.name="Main" 
 win.size={500,300} 
 win.border_width=10 
 win.resizable=true 
 win.title="Test Number One" 
 win.connect("destroy","Quit") 
 
Box pan = new()  
 
Label lb1 = new() 
 lb1.markup="<span color='red'>Happy</span><span color='blue'>Holidays</span>!" 
 lb1.font="Balmoral D 36" 
 lb1.angle=45 
 lb1.xalign=0 
 
Label lb2 = new() 
 lb2.font = "attack of the cucumbers bold 12" 
 lb2.markup = "Created with Phix and GTK" 
Paned pain = new()  
 
TextView tv = new()  
 tv.font="Karumbi 28" 
 tv.background_color="black" 
 tv.text_color="yellow" 
 
TextBuffer buffy = new() -- I typed in the text here 
 
ButtonBox bx = new()  
Button b1 = new() 
 b1.label="gtk-quit" 
 b1.name="Exit Button" 
 b1.connect("clicked","Quit") 
 bx.add(b1) 
 
win.add(pan) 
pan.add(pain) 
pan.add(lb2) 
pain.add1(lb1) 
pain.add2(tv) 
pan.pack_end(bx) 
 
win.show_all() 
 
gtk_main() 
 

Making some progress, but a long way to go. Phix actually makes this relatively easy. Most of the code to "wrap" GTK calls are three-liners:

procedure set_label(string x)  
  c_proc(define_c_proc(GTK,"gtk_button_set_label",{P,P}),{this.handle,x}) 
end procedure 

With EuGTK, this was a lot more complex.

  • this compiles in about a quarter of a second into a 2 meg executable.
  • the Geany editor works well with Phix.

Just over 3,000 routines to test

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu