[pygtk] GUI design question / palette and horizontal panes
Mark Mruss
selsine at gmail.com
Mon Mar 31 21:45:47 WST 2008
Hi Skip and Facundo,
Thanks for the replies, I've played with it a bit and I've been able
to get it basically working using two horizontal panes. I'm still
working on the logic a little bit, but I think it's something that
will come after using it for a while.
Does either of you, or anyone else, have any ideas regarding my
"button palette" question? Basically I would like to set something up
like Glade, or The Gimp uses to select the corrent tool. A Small grid
of buttons with only icons on them. So far I've been using a toolbar
with gtk.RadioToolButtons. This "works" however the buttons are too
large (I think for possible text) and I'm thinking that there must be
a better way.
On Fri, Mar 28, 2008 at 11:05 PM, Facundo Batista
<facundobatista at gmail.com> wrote:
> 2008/3/28, Mark Mruss <selsine at gmail.com>:
>
>
> > I would like to like to have three horizontal panes likes you often
> > see in IDE or in glade itself. I can't seem to figure out how to
> > accomplish this? Do I simply add another horizontal pane into one of
> > the positions of a horizontal pane?
>
> Yeap. It's tricky to whom add ScrollBars, though.
>
> Check this code, where I have four panes arranged like a square, and
> you can resize everything and works nicely (note: I just trimmed other
> stuff from here, hope didn't break anything, but you'll get the idea):
>
>
> class ExploitBody(gtk.HPaned):
> def __init__(self):
> super(ExploitBody,self).__init__()
>
> # left & right
> exploitvuln = self._buildExplVuln()
> interac = self._buildInteraction()
>
> # pack it all and show
> self.pack1(exploitvuln)
> self.pack2(interac)
> self.set_position(500)
>
> self.show()
>
> def _buildExplVuln(self):
> pan = gtk.HPaned()
>
> # left
> exploitlist = ExploitTree(self.w3af)
> scrollwin1 = gtk.ScrolledWindow()
> scrollwin1.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
> scrollwin1.add_with_viewport(exploitlist)
> scrollwin1.show()
>
> # rigth
> interac = VulnerabTree(self.w3af, exploitlist)
> scrollwin2 = gtk.ScrolledWindow()
> scrollwin2.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
> scrollwin2.add_with_viewport(interac)
> scrollwin2.show()
>
> # pack it all and show
> pan.pack1(scrollwin1)
> pan.pack2(scrollwin2)
> pan.set_position(250)
> pan.show()
> return pan
>
> def _buildInteraction(self):
> pan = gtk.VPaned()
>
> # left
> shells = Shells()
> scrollwin1 = gtk.ScrolledWindow()
> scrollwin1.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
> scrollwin1.add_with_viewport(shells)
> scrollwin1.show()
>
> # rigth
> proxies = Proxies()
> scrollwin2 = gtk.ScrolledWindow()
> scrollwin2.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
> scrollwin2.add_with_viewport(proxies)
> scrollwin2.show()
>
> # pack it all and show
> pan.pack1(scrollwin1)
> pan.pack2(scrollwin2)
> pan.set_position(200)
> pan.show()
> return pan
>
>
> Regards,
>
> --
> . Facundo
>
> Blog: http://www.taniquetil.com.ar/plog/
> PyAr: http://www.python.org/ar/
>
More information about the pygtk
mailing list