Re: PyGTK, Glade/libglade. What am I doing wrong?
On Sat, 07 May 2011 15:14:07 +1100, Даниил Рыжков wrote: Thanks, Cristian! It works. List of Pygtk: http://www.daa.com.au/mailman/listinfo/pygtk Thanks again. Subscribed :) 2011/5/7 craf pyclut...@gmail.com: Hi. Try this: #!/usr/bin/env python import gtk.glade class TestPyGtk: This is an Hello World GTK application def __init__(self): #Set the Glade file self.gladefile = test.glade self.glade = gtk.glade.XML(self.gladefile) self.MainWindow = self.glade.get_widget('MainWindow') self.MainWindow.show() self.MainWindow.connect('destroy', lambda e:gtk.main_quit()) TestPyGtk() gtk.main() Regards. Cristian. List of Pygtk: http://www.daa.com.au/mailman/listinfo/pygtk you may also want to look at using gtk.builder instread as it is now the prefered option. -- The human mind ordinarily operates at only ten percent of its capacity -- the rest is overhead for the operating system. -- http://mail.python.org/mailman/listinfo/python-list
PyGTK, Glade/libglade. What am I doing wrong?
Sorry for my English (I could not find help in the Russian community) I'm trying to learn PyGTK and Glade. I made test window in Glade and saved it as test.glade (attached). Then I wrote script test.py(attached, http://pastebin.com/waKytam3). I tried to run it. While the script was executed, console did not show anything and window wasn't displayed. When I pressed CTRL+С console displayed trackback: --- CTraceback (most recent call last): File test.py, line 32, in module gtk.main() KeyboardInterrupt --- So what am I doing wrong? -- Best wishes, Daniil #!/usr/bin/env python import sys try: import pygtk pygtk.require(2.0) except: pass try: import gtk import gtk.glade except: sys.exit(1) class TestPyGtk: This is an Hello World GTK application def __init__(self): #Set the Glade file self.gladefile = test.glade self.wTree = gtk.glade.XML(self.gladefile) #Create our dictionay and connect it dic = {on_MainWindow_destroy : gtk.main_quit } self.wTree.signal_autoconnect(dic) if __name__ == __main__: TestPyGtk = TestPyGtk() gtk.main() test.glade Description: application/glade -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGTK, Glade/libglade. What am I doing wrong?
On May 6, 2011 7:05 PM, Даниил Рыжков daniil...@gmail.com wrote: Sorry for my English (I could not find help in the Russian community) I'm trying to learn PyGTK and Glade. I made test window in Glade and saved it as test.glade (attached). Then I wrote script test.py(attached, http://pastebin.com/waKytam3). I tried to run it. While the script was executed, console did not show anything and window wasn't displayed. When I pressed CTRL+С console displayed trackback: --- CTraceback (most recent call last): File test.py, line 32, in module gtk.main() KeyboardInterrupt --- So what am I doing wrong? I haven't used gtk before, but is there a show method or something similar you need, to actually make the window appear? The KeyboardInterrupt is normal. That's how control-c works. -- Best wishes, Daniil -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGTK, Glade/libglade. What am I doing wrong?
I haven't used gtk before, but is there a show method or something similar you need, to actually make the window appear? I don't know. I think self.wTree = gtk.glade.XML(self.gladefile) should do this. For example, author of this tutorial (http://www.learningpython.com/2006/05/07/creating-a-gui-using-pygtk-and-glade/) wrote script similar to my. P.S. I have glade3 3.8.0, gtk 2.24.4, GNOME 2.32.1 and Python 2.7.1 -- Best wishes, Daniil -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGTK, Glade/libglade. What am I doing wrong?
On May 6, 2011 7:05 PM, Даниил Рыжков daniil...@gmail.com wrote: Sorry for my English (I could not find help in the Russian community) I'm trying to learn PyGTK and Glade. I made test window in Glade and saved it as test.glade (attached). Then I wrote script test.py(attached, http://pastebin.com/waKytam3). I tried to run it. While the script was executed, console did not show anything and window wasn't displayed. When I pressed CTRL+С console displayed trackback: --- CTraceback (most recent call last): File test.py, line 32, in module gtk.main() KeyboardInterrupt --- So what am I doing wrong? I haven't used gtk before, but is there a show method or something similar you need, to actually make the window appear? The KeyboardInterrupt is normal. That's how control-c works. -- Best wishes, Daniil -- http://mail.python.org/mailman/listinfo/python-list Hi. Try this: #!/usr/bin/env python import gtk.glade class TestPyGtk: This is an Hello World GTK application def __init__(self): #Set the Glade file self.gladefile = test.glade self.glade = gtk.glade.XML(self.gladefile) self.MainWindow = self.glade.get_widget('MainWindow') self.MainWindow.show() self.MainWindow.connect('destroy', lambda e:gtk.main_quit()) TestPyGtk() gtk.main() Regards. Cristian. List of Pygtk: http://www.daa.com.au/mailman/listinfo/pygtk -- http://mail.python.org/mailman/listinfo/python-list
Re: PyGTK, Glade/libglade. What am I doing wrong?
Thanks, Cristian! It works. List of Pygtk: http://www.daa.com.au/mailman/listinfo/pygtk Thanks again. Subscribed :) 2011/5/7 craf pyclut...@gmail.com: Hi. Try this: #!/usr/bin/env python import gtk.glade class TestPyGtk: This is an Hello World GTK application def __init__(self): #Set the Glade file self.gladefile = test.glade self.glade = gtk.glade.XML(self.gladefile) self.MainWindow = self.glade.get_widget('MainWindow') self.MainWindow.show() self.MainWindow.connect('destroy', lambda e:gtk.main_quit()) TestPyGtk() gtk.main() Regards. Cristian. List of Pygtk: http://www.daa.com.au/mailman/listinfo/pygtk -- Best wishes, Daniil -- http://mail.python.org/mailman/listinfo/python-list