You are not logged in.

#1 2008-07-20 02:56:36

vsk
Member
Registered: 2008-05-27
Posts: 70

Glade 3 + Python GUI help appreciated!

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

#2 2008-07-20 03:58:07

abhidg
Member
From: City of Kol
Registered: 2006-07-01
Posts: 184
Website

Re: Glade 3 + Python GUI help appreciated!

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

#3 2008-07-20 14:31:12

vsk
Member
Registered: 2008-05-27
Posts: 70

Re: Glade 3 + Python GUI help appreciated!

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

#4 2008-07-21 07:48:37

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Glade 3 + Python GUI help appreciated!

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

#5 2008-07-21 21:20:17

jordi
Member
Registered: 2006-12-16
Posts: 103
Website

Re: Glade 3 + Python GUI help appreciated!

    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

#6 2008-07-21 22:56:43

vsk
Member
Registered: 2008-05-27
Posts: 70

Re: Glade 3 + Python GUI help appreciated!

Thank you!

I figured out the textbuffer dilemma, just;

self.textview = self.wTree.get_widget("textview1")
self.buffer = self.textview.get_buffer()

Offline

Board footer

Powered by FluxBB