Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
gtk interface (with glade) don't wanna run
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Mathspeedy, post: 4642703"] Hi all, well I'm not really good with User interface, and I decided to make one for this little program: [code] #!/usr/bin/ruby class Programming_menu #show a menu offering programming utilities def show_menu() puts "1. gedit (Text Editor...) **" puts "2. Glade 3 (Interface designer) **" puts "3. Terminal" puts "4. IRB (interactive ruby)" puts "5. Blender (3D modeler) **" puts "6. Gimp (2D editor) **" puts "7. GTKRadiant (Game map editor) **" puts "8. Dia (diagram designer) **" puts "9. Hex editor **" puts "10. TOP (app monitor)" puts "11. EXIT (please read the advertisement)" puts "-=====================================-" puts "if app return infos just press ENTER" puts "EXITING this program will exit ** apps" puts "-=====================================-" end #ask for the choice def choice() puts "Please enter the number of the wanted app." choice = gets.to_i if choice == 1 system("gedit &") elsif choice == 2 system("glade-3 &") elsif choice == 3 system("gnome-terminal") elsif choice == 4 system("gnome-terminal -e irb") elsif choice == 5 system("blender &") elsif choice == 6 system("gimp &") elsif choice == 7 system("/opt/gtkradiant/radiant.x86 &") elsif choice == 8 system("dia &") elsif choice == 9 system("ghex2 &") elsif choice == 10 system("gnome-terminal -e top") elsif choice == 11 break end end #main process. pc = Programming_menu.new pc.show_menu() pc.choice() loop do system("clear") pc.show_menu() pc.choice() end end [/code] and this is the code with GUI [code] #!/usr/bin/ ruby require 'libglade2' class GpumGlade include GetText attr :glade def initialize(path_or_data, root = nil, domain = nil, localedir = nil, flag = GladeXML::FILE) bindtextdomain(domain, localedir, nil, "UTF-8") @glade = GladeXML.new(path_or_data, root, domain, localedir, flag) {|handler| method(handler)} end def on_gimp_button_clicked(widget) puts "on_gimp_button_clicked() is not implemented yet." end def on_window_delete_event(widget, arg0) Gtk.main_quit end def on_gedit_button_clicked(widget) system("gedit &") end def on_irb_button_clicked(widget) system("gnome-terminal -e irb &") end def on_term_button_clicked(widget) system("gnome-terminal &") end def on_top_button_clicked(widget) system("gnome-terminal -e top &") end def on_blender_button_clicked(widget) system("blender &") end def on_dia_button_clicked(widget) system("dia &") end def on_glade_button_clicked(widget) system("glade-3 &") end def on_radiant_button_clicked(widget) system("/opt/gtkradiant/radiant.x86 &") end def on_hex_button_clicked(widget) system("ghex2 &") end end # Main program if __FILE__ == $0 # Set values as your own application. PROG_PATH = "GPUM.glade" PROG_NAME = "YOUR_APPLICATION_NAME" GpumGlade.new(PROG_PATH, nil, PROG_NAME) Gtk.main end [/code] Can someone could tell me why it is not working ... [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
gtk interface (with glade) don't wanna run
Top