Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #4885 > unrolled thread
| Started by | craf <pyclutter@gmail.com> |
|---|---|
| First post | 2011-05-07 00:47 -0300 |
| Last post | 2011-05-07 00:47 -0300 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: PyGTK, Glade/libglade. What am I doing wrong? craf <pyclutter@gmail.com> - 2011-05-07 00:47 -0300
| From | craf <pyclutter@gmail.com> |
|---|---|
| Date | 2011-05-07 00:47 -0300 |
| Subject | Re: PyGTK, Glade/libglade. What am I doing wrong? |
| Message-ID | <mailman.1283.1304740071.9059.python-list@python.org> |
On May 6, 2011 7:05 PM, "Даниил Рыжков" <daniil.re@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
Back to top | Article view | comp.lang.python
csiph-web