473,467 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1588
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. ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.