[pygtk] Adding menu items at runtime
Alexandre González
alex at rianxosencabos.com
Sat Jun 6 02:03:02 WST 2009
Hi!
I'm newbie in python and Gtk programming, but I thinks that this can solver
you problem.
I have a Class Widgets that load (with GtkBuilder) my glade file, and in
this class I have a method __getitem__ that return
self.builde.get_object(key) so if you use this mehod, you cand work with the
Gtk Menu to .add .remove or what you like to do with it.
If you have more troubles I can send you my first python+glade project to
see how I do it.
Regards,
Alex Gonzalez
On Fri, Jun 5, 2009 at 19:28, Alessandro Dentella <sandro at e-den.it> wrote:
> On Wed, Jun 03, 2009 at 01:01:44PM +0200, Johannes Bauer wrote:
> > Hello list,
> >
> > I have a Pyton application which reads in some plugins and needs to add
> > items to a "plugins" menu accordingly at runtime. Now I expected to to a
> > builder/get for the MenuItem parent entry and then use "add" (as
> > MenuItem inherits from Bin).
> >
> > But - weird: Although in the glade-File I see my "Plugins_MenuItem" as
> > of type "GtkMenuItem", in the generated XML it is of type "GtkAction"
> > (and is so also during runtime). I cannot add children to a GtkAction,
> > however...
>
> I don't use glade, so I can't be of help with that, but testing it with
> glade I don't get GtkAction entries.
>
> I only recently started using the gtk.UIManager() object and that's in my
> opinion the better way to go if you want a simple and dynamic solution.
>
> sandro
> *:-)
> _______________________________________________
> pygtk mailing list pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
--
Please, don't send me files with extensions: .doc, .docx, .xls, .xlsx, .ppt
and/or .pptx
http://mirblu.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20090605/d79a320f/attachment.htm
More information about the pygtk
mailing list