Advertisement
Guest User

Untitled

a guest
Jul 17th, 2012
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.88 KB | None | 0 0
  1. Glade3 Python Tutorials
  2. =======================
  3. John Thornton
  4. v1.0, (C) 2012
  5. :doctype: book
  6.  
  7. link:index.html[Index]
  8.  
  9. == Requirements
  10.  
  11. To start with I'm using Ubuntu 10.04 and yes it is a little dated but I use
  12. it because I'm involved with LinuxCNC software and that is the latest version
  13. supported by the real time kernel.
  14.  
  15. I have Glade 3.6.7 installed and Python 2.6.5 so anything newer should work.
  16.  
  17. == Glade Project
  18.  
  19. Run Glade3 and the first screen you will see is the 'Project Preferences'. For
  20. now you can just accept the defaults.
  21.  
  22. image::images/project-preferences.png[align="center"]
  23.  
  24. Now you have an empty project. Press 'F1' to bring up the help menu then select
  25. 'Getting Started'. Notice what each section of the Glade3 Interface is called.
  26.  
  27. First thing we need is a window so from the 'Palette' > 'Toplevels' click on
  28. the 'window' and you should have a screen like the following.
  29.  
  30. image::images/glade-01-01.png[align="center",width=640]
  31.  
  32. From the 'Palette' > 'Containers' click on the vertical box, then click in the
  33. window and leave the number at three in the pop up. You should now have a
  34. screen like the following.
  35.  
  36. image::images/glade-01-02.png[align="center",width=640]
  37.  
  38. Now we will add a menu to the top section of the vertical box from the
  39. 'Containers', a 'label' to the middle of the vertical box from the
  40. 'Control and Display' section of the 'Palette' and a 'status bar' to the
  41. bottom section of the vertical box from the 'Control and Display' section.
  42. And just accept the default for now of 3 items.
  43. Your screen should look like the following.
  44.  
  45. image::images/glade-01-03.png[align="center",width=640]
  46.  
  47. Now we need to create a signal from the 'Quit' on the menu. The default name for
  48. Quit is 'imagemenuitem5' which is a bit cryptic so we will change that to
  49. 'gtk_quit'. In the 'Inspector' click on 'imagemenuitem5' then in the 'General'
  50. tab of the 'Properties' dialog change the 'Name:' to 'gtk_quit'.
  51.  
  52. image::images/glade-01-04.png[align="center",width=640]
  53.  
  54. Now in the 'Signals' tab of the 'Properties' dialog under 'GtkMenuItem' in the
  55. 'Handler' column click on the '<Type here>' next to the 'activate' Signal.
  56. From the drop down box select 'on_gtk_quit_activate' then press 'Enter'.
  57. Your screen should look like the following.
  58.  
  59. image::images/glade-01-05.png[align="center",width=640]
  60.  
  61. Next we need to create a signal from the main window if someone clicks on the
  62. 'X' in the corner to close the window. Click on 'window1' in the 'Inspector'
  63. then the 'Signals' tab and then 'GtkObject' and for the handler select
  64. 'on_window1_destroy'.
  65.  
  66. image::images/glade-01-06.png[align="center",width=640]
  67.  
  68. Ok, that's it for the Glade3 part of this super short tutorial. Save your
  69. Glade3 file as 'tutorial-1.glade' to an empty directory and don't forget
  70. to type in the .glade extension as it is not automagiclly added.
  71.  
  72. Next up link:glade02.html[Part 2 The Python Part].
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement