Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Glade3 Python Tutorials
- =======================
- John Thornton
- v1.0, (C) 2012
- :doctype: book
- link:index.html[Index]
- == Requirements
- To start with I'm using Ubuntu 10.04 and yes it is a little dated but I use
- it because I'm involved with LinuxCNC software and that is the latest version
- supported by the real time kernel.
- I have Glade 3.6.7 installed and Python 2.6.5 so anything newer should work.
- == Glade Project
- Run Glade3 and the first screen you will see is the 'Project Preferences'. For
- now you can just accept the defaults.
- image::images/project-preferences.png[align="center"]
- Now you have an empty project. Press 'F1' to bring up the help menu then select
- 'Getting Started'. Notice what each section of the Glade3 Interface is called.
- First thing we need is a window so from the 'Palette' > 'Toplevels' click on
- the 'window' and you should have a screen like the following.
- image::images/glade-01-01.png[align="center",width=640]
- From the 'Palette' > 'Containers' click on the vertical box, then click in the
- window and leave the number at three in the pop up. You should now have a
- screen like the following.
- image::images/glade-01-02.png[align="center",width=640]
- Now we will add a menu to the top section of the vertical box from the
- 'Containers', a 'label' to the middle of the vertical box from the
- 'Control and Display' section of the 'Palette' and a 'status bar' to the
- bottom section of the vertical box from the 'Control and Display' section.
- And just accept the default for now of 3 items.
- Your screen should look like the following.
- image::images/glade-01-03.png[align="center",width=640]
- Now we need to create a signal from the 'Quit' on the menu. The default name for
- Quit is 'imagemenuitem5' which is a bit cryptic so we will change that to
- 'gtk_quit'. In the 'Inspector' click on 'imagemenuitem5' then in the 'General'
- tab of the 'Properties' dialog change the 'Name:' to 'gtk_quit'.
- image::images/glade-01-04.png[align="center",width=640]
- Now in the 'Signals' tab of the 'Properties' dialog under 'GtkMenuItem' in the
- 'Handler' column click on the '<Type here>' next to the 'activate' Signal.
- From the drop down box select 'on_gtk_quit_activate' then press 'Enter'.
- Your screen should look like the following.
- image::images/glade-01-05.png[align="center",width=640]
- Next we need to create a signal from the main window if someone clicks on the
- 'X' in the corner to close the window. Click on 'window1' in the 'Inspector'
- then the 'Signals' tab and then 'GtkObject' and for the handler select
- 'on_window1_destroy'.
- image::images/glade-01-06.png[align="center",width=640]
- Ok, that's it for the Glade3 part of this super short tutorial. Save your
- Glade3 file as 'tutorial-1.glade' to an empty directory and don't forget
- to type in the .glade extension as it is not automagiclly added.
- Next up link:glade02.html[Part 2 The Python Part].
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement