473,668 Members | 2,600 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Red Hat 9, Python and Glade - a mixure not working?

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):

-------------------------
#!/usr/bin/python

import gtk
import gtk.glade
import sys

def on_button4_clic ked(source=None , event=None):
sys.exit();

gtk.glade.XML(' project3.glade' )
xml.autoconnect ({
'on_button4_cli cked': on_button4_clic ked
})

gtk.main()
-------------------------

Now when I am running it, I get the following error:

-------------------------
(run2.py:11714) : GLib-GObject-CRITICAL **: file gobject.c: line 1002
(g_object_get): assertion `G_IS_OBJECT (object)' failed

(run2.py:11714) : GLib-GObject-CRITICAL **: file gobject.c: line 1002
(g_object_get): assertion `G_IS_OBJECT (object)' failed
Erreur de segmentation
-------------------------

I am running redhat 9 with the lastest updates and glade-2. Anybody
has a clue how to get it running? Is there a python program that
comes in one of RH 9 packages that makes use of glade? I could use it
as an example.
Regards,
Hans Deragon
Jul 18 '05 #1
3 4298
In article <c7************ **************@ posting.google. com>, Hans Deragon
wrote:
def on_button4_clic ked(source=None , event=None):
You should exit the mainloop here:

gtk.main_quit()
sys.exit();

gtk.glade.XML(' project3.glade' )
Should be

xml = gtk.glade.XML(' project3.glade' )
xml.autoconnect ({
'on_button4_cli cked': on_button4_clic ked
})


Or you can just use

xml.signal_auto connect(locals( ))

See glade_demo.py in the /usr/share/doc/pygtk2-1.99.14/examples/glade/.

For more info on pygtk see

http://www.async.com.br/faq/pygtk/index.py?req=index
http://www.moeraki.com/pygtkreference/pygtk2reference/

Dave Cook
Jul 18 '05 #2
"David M. Cook" <da******@nowhe re.net> wrote in message news:<d2******* *************@n ews2.central.co x.net>...
In article <c7************ **************@ posting.google. com>, Hans Deragon
wrote:


[...deleted lines...]
gtk.glade.XML(' project3.glade' )


Should be

xml = gtk.glade.XML(' project3.glade' )


Ok, here I am embarrassed... forgetting to assign xml... ;)
xml.autoconnect ({
'on_button4_cli cked': on_button4_clic ked
})


Or you can just use

xml.signal_auto connect(locals( ))

See glade_demo.py in the /usr/share/doc/pygtk2-1.99.14/examples/glade/.


Thanks for the tips. But the problem still persist. Now I run the
following:

------------------
[root@world project3]#
/usr/share/doc/pygtk2-1.99.14/examples/glade/glade-demo.py
project3.glade

(glade-demo.py:3405): GLib-GObject-CRITICAL **: file gobject.c: line
1002 (g_object_get): assertion `G_IS_OBJECT (object)' failed

(glade-demo.py:3405): GLib-GObject-CRITICAL **: file gobject.c: line
1002 (g_object_get): assertion `G_IS_OBJECT (object)' failed
Segmentation fault
------------------

So the problem is not my code. I must assume that the glade module
for gnome is not adapted for taking in Glade 2 xml?

Then I tried with a Glade 1 xml:

-----------------
[root@world project2]#
/usr/share/doc/pygtk2-1.99.14/examples/glade/glade-demo.p
y project2.glade

(glade-demo.py:3541): libglade-WARNING **: Expected <glade-interface>.
Got <GTK
-Interface>.

(glade-demo.py:3541): libglade-WARNING **: did not finish in
PARSER_FINISH state
Traceback (most recent call last):
File "/usr/share/doc/pygtk2-1.99.14/examples/glade/glade-demo.py",
line 12, in
?
xml = gtk.glade.XML(f name)
RuntimeError: could not create GladeXML object
-----------------

Different errors, same results. Nothing works. However the
test.glade xml file provided as an example works fine. I believe that
there is some widget in my glade2 xml file that is simply not
supported by python. I will investigate further the issue later.

Thanks,
Hans Deragon
Jul 18 '05 #3
In article <c7************ *************@p osting.google.c om>, Hans Deragon wrote:

Thanks for the tips. But the problem still persist. Now I run the
following:
Do you have gnome widgets in your xml file? You'll need to import gnome.ui
and do a gnome.init().

See the pygtk FAQ:

http://www.async.com.br/faq/pygtk/index.py?req=all

You might also try putting the line

import pygtk; pygtk.require(' 2.0')

at the top of your file. Also try running with python -v so you can see
what modules are being loaded.
So the problem is not my code. I must assume that the glade module
for gnome is not adapted for taking in Glade 2 xml?
In fact, libglade2 *only* works with glade 2 files. glade 1 files have to
be converted first.
Different errors, same results. Nothing works. However the
test.glade xml file provided as an example works fine. I believe that
there is some widget in my glade2 xml file that is simply not
supported by python. I will investigate further the issue later.


I've never encountered this problem with my own glade 2 files. However, I
don't have a "pristine" RH 9 installation to play with right now.

I suggest taking this problem to the pygtk mailing list. If it's not
quickly fixable then it needs to be fixed somewhere up the line.

Dave Cook
Jul 18 '05 #4

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

Similar topics

9
13676
by: Edilmar | last post by:
Hi, First of all, I'm new in Python... I have worked with manu langs and IDEs, like Delphi, VB, JBuilder, Eclipse, Borland C++, Perl, etc... Then, today I think IDEs like Delphi have a excelent environment to develop apps with little time. I saw many people talking about Python like a easy lang to learn and to develop. But I have look at IDEs for Python, or ways
37
10418
by: Ubaidullah Nubar | last post by:
Hi, How well is Python suited for developing database based applications? I am new to Python so please bear with me if some of the questions are too simple. I specifically have the following questions: 1. Is there an example of a simple data-entry application written in Python using a GUI interface? Something like a simple address book app with a listbox displaying all addresses with the ability to add/modify/delete.
59
4280
by: Hugh Macdonald | last post by:
I've recently been trying out various different GUI frameworks in Python and was wondering if I could get your input on the pros and cons of the different ones... wxPython: I love the programming side of wxPython, but I find it's just so slow to initialise in the first place. Tkinter: While it's fast to load up, the syntax has never really appealed to me
5
2612
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 rapidly as ppls used to work on win32 platform with VB. http://www40.brinkster.com/s4somesh/glade/index.html somesh
7
3213
by: Madhusudan Singh | last post by:
Is there such a thing for python ? Like Qt Designer for instance ?
0
1203
by: Doug | last post by:
I am having some fun running a program called pygps. This uses libglade and runs fine on my very old Redhat 7.? system running Python 1.5.2. I have not needed to make any changes to the import files (see below). The program uses a glade generated pygps.glade xml file for the gui. I like the way this works and the ability to edit the xml(?) with glade. Now on my Fedora system which has version 2 of just about everything it will not...
6
2893
by: Doug | last post by:
Hi all, Can someone tell me why I do not get a connection between the events and the functions in the sample below. GUI window appears OK, just no connections seem to be made. I am new to this so may be missing something fundamental. Thanks, Doug
4
2744
by: conan | last post by:
This regexp '<widget class=".*" id=".*">' works well with 'grep' for matching lines of the kind <widget class="GtkWindow" id="window1"> on a XML .glade file However that's not true for the re module in python, since this one takes the regexp as if were specified this way: '^<widget class=".*"
5
2555
by: holmes86 | last post by:
hi,everyone. I am a python newbie.and I write a python program with glade,as following: import sys import gtk import gtk.glade class TLaitSignals: '''Define TLait singals handler'''
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8371
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8572
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6206
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4202
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2782
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.