Newbie in the deep - some PyGTK questions

Dieter Verfaillie dieterv at optionexplicit.be
Sat Feb 24 09:26:14 EST 2007


Hi,

On Fri, 2007-02-23 at 11:36 +0000, nmp wrote:
> First "problem": when I insert the glade file in my application the way
> some tutorials have shown me:
> 
>     self.wTree = gtk.glade.XML("autostart.glade", "mainWindow")
> 
> ... Python is consistently giving me this warning:
> 
>     /home/xxxx/Projecten/autostart/autostart.py:18: GtkWarning:
>     gtk_widget_grab_default: assertion `GTK_WIDGET_CAN_DEFAULT (widget)'
>     failed
>     self.wTree = gtk.glade.XML("autostart.glade", "mainWindow")

I think you've set the "Has default" property to Yes on some
widget, but you forgot to set the "Can default" property
to Yes on that same widget.
In short, you created a default widget that can't be the default and
gtk happily complains about that. Check your glade file to fix it.

> Now I want the user of my program to be able to just double click a row or
> hit Enter to flip the boolean, so FALSE becomes TRUE and vice versa.

See the answer to your third "problem" :)

> The third "problem" (for now...) is really just a cosmetic thing. The
> representation of the boolean in the list is fine for me, but in time I
> would like to make it prettier by replacing it with a graphical checkbox.
> Does anyone have an example of this that I can use?

Use a CellRendererToggle. There's a tutorial on the pygtk website:
http://pygtk.org/pygtk2tutorial/sec-CellRenderers.html (scroll all the
way down that page to "Figure 14.6. Editable and Activatable Cells")

> Thank you for your patience. I can already see how all this is going to
> keep me busy for weeks and it will be fun ;)

You'll probably get faster/better answers to you pygtk questions on the
pygtk mailing list: http://www.daa.com.au/mailman/listinfo/pygtk

Have fun,
Dieter




More information about the Python-list mailing list