[pygtk] beginner frustration with layout - buttons.py
Abhijeet Rastogi
abhijeet.1989 at gmail.com
Mon Sep 12 16:16:49 WST 2011
How!! How! How could I miss that. Thanks Petr. :) The diff you provided
worked perfectly, the way I wanted. So, things I learned include, we have a
show.all() method that shows all widgets and don't do something this silly.
2011/9/12 Petr Kubánek <petr at kubanek.net>
> user at host:~$ diff -u /tmp/t /tmp/t.py
> --- /tmp/t 2011-09-12 08:13:57.643015082 +0200
> +++ /tmp/t.py 2011-09-12 08:17:08.748520229 +0200
> @@ -66,15 +66,12 @@
>
> # Pack and show all our widgets
> button.add(button_box)
> - button_box.show()
>
> self.superbox.pack_start(button, False, False, 2)
> - button.show()
> self.superbox.pack_start(label, False, False, 2)
> - label.show()
>
> - self.superbox.show()
> - self.window.show()
> + self.window.add(self.superbox)
> + self.window.show_all()
>
> def main():
> gtk.main()
>
> Petr
>
> Abhijeet Rastogi píše v Po 12. 09. 2011 v 11:56 +0530:
> > Hi Petr,
> >
> > I don't get it. From the examples I saw about packing, I saw that
> > self.window.add calls.
> > http://www.pygtk.org/pygtk2tutorial/sec-DetailsOfBoxes.html
> >
> > So, how can I solve that? I mean, I don't understand, if those
> > examples had window.add and you are saying that it creates an empty
> > window, then how were those widdgets displated?
> >
> >
> > 2011/9/12 Petr Kubánek <petr at kubanek.net>
> > What about:
> >
> > self.window.add(something)
> >
> > in the code? What you did is you created an empty window.
> >
> > Also you can delete all .show() calls and replace this with:
> >
> > self.window.show_all()
> >
> > Petr
> >
> > Abhijeet Rastogi píše v Po 12. 09. 2011 v 10:56 +0530:
> >
> > > Hi guyz,
> > >
> > > I was following the tutorial to learn pygtk. I had this
> > example
> > > http://www.pygtk.org/pygtk2tutorial/ch-ButtonWidget.html
> > (buttons.py)
> > >
> > > So, I decided to add one more label at the bottom of already
> > displayed
> > > button.
> > >
> > > So, I added
> > >
> > > # Create a text label
> > > label = gtk.Label("Label")
> > >
> > > And added a Vbox using
> > >
> > > # Creating a VBox
> > > self.superbox = gtk.VBox(False, 0)
> > >
> > > And the I packed everything in superbox and displayed & all
> > I get is a
> > > tiny window with nothing in it.
> > >
> > > My complete script -> http://sprunge.us/VUYB
> > >
> > > Please guide me. It will just take a minute for people
> > knowing about
> > > layouts.
> > >
> > >
> > > Regards,
> > > Abhijeet Rastogi (shadyabhi)
> > > http://www.google.com/profiles/abhijeet.1989
> >
> > > _______________________________________________
> > > pygtk mailing list pygtk at daa.com.au
> > > http://www.daa.com.au/mailman/listinfo/pygtk
> > > Read the PyGTK FAQ: http://faq.pygtk.org/
> >
> >
> >
> >
> >
> > --
> > Regards,
> > Abhijeet Rastogi (shadyabhi)
> > http://www.google.com/profiles/abhijeet.1989
>
>
>
--
Regards,
Abhijeet Rastogi (shadyabhi)
http://www.google.com/profiles/abhijeet.1989
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.daa.com.au/pipermail/pygtk/attachments/20110912/63c5741f/attachment-0001.html>
More information about the pygtk
mailing list