Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #80332

Re: wxPython Boxsizers

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: wxPython Boxsizers
Date 2014-11-06 09:15 -0500
Organization IISS Elusive Unicorn
References <m3fhkk$l3v$1@dont-email.me> <mailman.15541.1415269863.18130.python-list@python.org> <bc723af8-8643-4752-a904-c70096966439@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.15545.1415283327.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, 6 Nov 2014 05:50:37 -0800 (PST), Joy Deep <c.joydeep@gmail.com>
declaimed the following:

>I am using Python 2.7.6
>Here is the code I am trying:
>
>import wx
>
>class MyFrame(wx.Frame):
>    def __init__(self, *args, **kid's):
>        wx.Frame.__init__(self, *args, **kwds)
>        self.button_1 = wx.Button(self, wx.ID_ANY, "button_1")
>        self.button_2 = wx.Button(self, wx.ID_ANY, "button_2")
>        sizer_1 = wx.BoxSizer(wx.VERTICAL)
>        sizer_1.Add(self.button_1, 0, wx.ALL | wx.ALIGN_RIGHT, 1)
>        sizer_1.Add(self.button_2, 0, wx.ALL | wx.ALIGN_RIGHT | wx.ALIGN_BOTTOM, 1)
>        self.SetSizer(sizer_1)
>        sizer_1.Fit(self)
>        self.Layout()
>

	http://www.wxpython.org/docs/api/wx.BoxSizer-class.html

	As I understand it, a "vertical" box-sizer lets you distribute the
contents in a column. To position things horizontally will require some
higher level sizer to position the one one you have.

	Maybe something like (rough pseudo code -- I need to rush to go to
work)

	sh = sizer(horizontal)
	svl = sizer(vertical)
	svr = sizer(vertical)
	sh.add(svl, align_left)
	sh.add(svr, align_right)
	b1 = button()
	b2 = button()
	svr.add(b1, align_top)
	svr.add(b2, align_bottom)


>if __name__ == "__main__":
>    app = wx.PySimpleApp(0)
>    frame_1 = MyFrame(None, wx.ID_ANY, "")
>    frame_1.Show()
>    app.MainLoop()
>
>Thanks.
>
>
>
>On Thursday, November 6, 2014 4:01:53 PM UTC+5:30, Joel Goldstick wrote:
>> On Thu, Nov 6, 2014 at 5:13 AM, Jaydip Chakrabarty <c.joydeep@gmail.com> wrote:
>> > Hello,
>> >
>> > I am new to Python. I am learning boxsizer. I want to put two buttons on
>> > my panel. One at top right corner and one at bottom right corner. How do
>> > I achieve this?
>> >
>> > Thanks
>> 
>> First, what version of python.  What is boxsizer?  Show some code of
>> what you have tried.
>> > --
>> > https://mail.python.org/mailman/listinfo/python-list
>> 
>> 
>> 
>> -- 
>> Joel Goldstick
>> http://joelgoldstick.com
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

wxPython Boxsizers Jaydip Chakrabarty <c.joydeep@gmail.com> - 2014-11-06 10:13 +0000
  Re: wxPython Boxsizers Joel Goldstick <joel.goldstick@gmail.com> - 2014-11-06 05:31 -0500
    Re: wxPython Boxsizers Joy Deep <c.joydeep@gmail.com> - 2014-11-06 05:50 -0800
      Re: wxPython Boxsizers Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-06 09:15 -0500
  Re: wxPython Boxsizers Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-06 10:41 +0000

csiph-web