[pygtk] Accessing child widgets via instance variables
Drew Vogel
dvogel at intercarve.net
Sat Aug 30 01:02:45 WST 2008
Apparently when I inherit from gtk.Window it program segfaults. The
segfault message was just not displayed when I ran it from vim.
Drew
Drew Vogel wrote:
> If I inherit from gtk.Window as such:
>
> class DocWindow(gtk.Window, libglade.GladeWrapper):
>
> then program exits unexpectedly without any console output so I assumed
> that pygtk did not allow this. Therefore, since my DocWindow class does
> not inherit from gtk.Window, it has no show() method of it's own. If
> this still isn't clear I will paste a test case.
>
> Drew
>
>
>
> Dominic Salemno wrote:
>
>> Greetings,
>>
>> If my_win is already an instance of GtkWindow then to show it you merely
>> do something along this line: my_win.show()
>>
>> You should not have to do anything afterwards. If my_win does not
>> represent your window, what is this representing? If something else
>> entirely, choose a different variable name. Perhaps you could paste more
>> code for us to see?
>>
>> Your variable, if it indeed defines a GtkWindow, should be declared as
>> follows:
>>
>> self.my_win = gtk.Window(gtk.WINDOW_TOPLEVEL)
>>
>> Even if my_win is instantiating a custom class which in turn is
>> inheriting from gtk.Window, you would still perform the following to
>> show the window: self.my_win.show()
>>
>> If this is not working, please paste more code.
>>
>> Sincerely, Dominic Salemno.
>>
>>
>> Pádraig Brady wrote:
>>
>>
>>> Drew Vogel wrote:
>>>
>>>
>>>
>>>> Thanks, I have this mostly working. However it looks like instead of calling
>>>>
>>>> my_win.show()
>>>>
>>>> I now have to call
>>>>
>>>> my_win.GtkWindow.show()
>>>>
>>>> Is this correct?
>>>>
>>>>
>>>>
>>> Yes. my_win.GtkWindow is just a shortcut I thought was useful.
>>> To access other widgets, just use my_win.id.
>>>
>>> Pádraig.
>>> _______________________________________________
>>> pygtk mailing list pygtk at daa.com.au
>>> http://www.daa.com.au/mailman/listinfo/pygtk
>>> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>>>
>>>
>>>
>> _______________________________________________
>> pygtk mailing list pygtk at daa.com.au
>> http://www.daa.com.au/mailman/listinfo/pygtk
>> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>>
>>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20080829/b6cc6a1c/attachment.pgp
More information about the pygtk
mailing list