You are not logged in.
hello,
I'm a Python hobbyist and I'm looking to create PyGTK applications for my personal use.
I have tried writing pygtk code without using glade, but I find that things rarely work!
When they do, there are always subtle bugs with window position or response.
Many pygtk functions raise deprecation errors, and many just plain don't work as advertised!
So I want to use Glade to create my interface, but after consulting Google, I have found 0
online documentation that shows how to use Python to work with glade/gtk interfaces.
Does anyone know where I can find recent, reliable information regarding how to;
* connect signals to functions
* get key presses
* get a textview widget "out" of the .glade file and create a textbuffer to work with
Help on any one of those would be appreciated!
Thanks!
Offline
http://www.learningpython.com/2006/05/0 … and-glade/
This covers connecting signals to functions. The tutorial is for Debian, but the basic
points are the same.
Offline
The tutorial is for glade 2. I would prefer to be able to use glade 3.
I don't think the versions are compatible - different code is probably needed to work
with the newer .glade files.
edit: I was wrong - actually, most of the code is the same.
Thanks!
I'm still looking for keyboard functionality though.
Last edited by vsk (2008-07-20 15:00:04)
Offline
In the Glade GUI look for accellerators. You can choose the letters you want to connect there. For each you get to define a callback. Connect that like any other glade callback.
(excuse terminology if it's a bit off... i havn't worked with glade for a little bit, though this does work with glade3)
Last edited by iphitus (2008-07-21 07:49:05)
Offline
def on_window1_key_press_event(self,widget,event):
if event.keyval >= gtk.keysyms.F1 and event.keyval <= gtk.keysyms.F10:
elif event.keyval == gtk.keysyms.space:
elif event.keyval == gtk.keysyms.Return:
Dunno if it helps, but that would be an example for keyboard functionality.
Offline
Thank you!
I figured out the textbuffer dilemma, just;
self.textview = self.wTree.get_widget("textview1")
self.buffer = self.textview.get_buffer()
Offline