473,236 Members | 1,660 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,236 software developers and data experts.

glade/pygtk trouble on Red Hat 9

In July there was a thread about problems on Red Hat 9 with PyGTK
not playing nice with Glade. I was tinkering with this a little bit
tonight, starting with the code I found in this article:
http://www.linuxjournal.com/article.php?sid=6586

Based on what was written, I tried this and had no joy:
######################################
import gtk
import gtk.glade
class BadGui:
def __init__(self):
gladefile = "project1.glade"
windowname = "window1"
self.wTree = tree = gtk.glade.XML(gladefile, windowname)
d = { }
for name in dir(self.__class__):
d[name] = getattr(self, name)
tree.signal_autoconnect(d)
gtk.mainloop()
def on_button1_clicked(self, *args):
print "button 1 clicked"
gtk.mainquit()
def on_button2_clicked(self, *args):
print "button 2 clicked"
def on_window1_destroy(self, *args):
print args
gtk.mainquit()
BadGui()
###################################

After some puttering, I came up with the following, which
works just fine:
########################################
import gtk
import gtk.glade
class GoodGui:
def __init__(self):
gladefile = "project1.glade"
windowname = "window1"
self.wTree = tree = gtk.glade.XML(gladefile, windowname)
for name in dir(self.__class__):
if name.startswith("on_"):
widgetname = name.split("_")[1]
widget = tree.get_widget(widgetname)
action = name[4 + len(widgetname):]
widget.connect(action, getattr(self, name))
gtk.mainloop()
def on_button1_clicked(self, *args):
print "button 1 clicked"
gtk.mainquit()
def on_button2_clicked(self, *args):
print "button 2 clicked"
def on_window1_destroy(self, *args):
print args
gtk.mainquit()
GoodGui()
########################################

As far as I can tell, there seems to be a problem with
signal_autoconnect, either how it's implemented in libglade
or how it gets connected to Python. Anyway, I'm passing this
along for any who might find it helpful.

Jul 18 '05 #1
1 1579
P
Will Ware wrote:
In July there was a thread about problems on Red Hat 9 with PyGTK
not playing nice with Glade. I was tinkering with this a little bit
tonight, starting with the code I found in this article:
http://www.linuxjournal.com/article.php?sid=6586

Based on what was written, I tried this and had no joy:

As far as I can tell, there seems to be a problem with
signal_autoconnect, either how it's implemented in libglade
or how it gets connected to Python. Anyway, I'm passing this
along for any who might find it helpful.


Never had a problem with signal_autoconnect (on redhat 7.x or above)
Have a look at the libglade module for either of the GUI apps here:
http://www.pixelbeat.org/talks/pygtk/
It's much the same as the code you posted but it's worth trying.

--
Pádraig Brady - http://www.pixelbeat.org

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Hans Deragon | last post by:
Greetings. Total newbie to Glade here. I created an interface using glade-2 and I want to use it with my python program. Following is what I wrote (test prg): -------------------------...
1
by: Lian Liming | last post by:
Hi, I have installed Python2.3, PyGTK 2.0.0, python-gnome2 2.00.00, glade2. But when i run BloGTK, which is a tool for blogger developped in Python, the error information dislay: Traceback...
9
by: P. Jouin | last post by:
I work with Linux Mandrake10 and KDE. I have compiled and install : Python 2.3.4 pygtk-2.2.0 Glade2 2.6.0 My problem is : I want to know what can i do for having Python in the Language of...
8
by: p.kosina | last post by:
Does there exist any python plug-in (or something like that) for Glade 2.0.1. win32 port? I cant find any or links are unavailable. Thanks Pavel
5
by: somesh | last post by:
hello, I wrote a small tute for my brother to teach him python + glade, plz see, and suggest to make it more professional , In tute I discussed on Glade + Python for developing Applications too...
6
by: sapo | last post by:
Hi all, i ve started learning pygtk with glade, i m just making some test stuff. but i got some problems with simple things. I designed 2 windows on glade, then exported it and loaded in the...
0
by: Terry Hancock | last post by:
I've run into something a little odd on my Debian-installed Python 2.3. I have deb packages "python2.3", "python-gtk2", and "python2.3-glade2" installed on this machine. Among other things,...
5
by: Kveldulv | last post by:
I made simple GUI in Glade 3 (Ubuntu 7.04) consisting of only 2 buttons. When I run 2buttonsgui.py, no GUI pops out #!/usr/bin/env python import pygtk import gtk.glade class TwoButtonsGUI:...
2
by: Greg Johnston | last post by:
Hey all, I'm a relative newbie to Python (switched over from Scheme fairly recently) but I've been using PyGTK and Glade to create an interface, which is a combo I'm very impressed with. ...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.