How to set size to CheckBox

1,067 views
Skip to first unread message

阮明辉

unread,
Jun 14, 2011, 11:13:27 PM6/14/11
to wxpytho...@googlegroups.com
Hi, I was new to wxPython , I use wxPython2.8.12.0 and python2.7.1
I use a CheckBox , and I set it's size 

self.is_backup = wx.CheckBox(self.panel_up, label=u'backup', size=(150, 50), style=wx.SHAPED)

but it seems not work , The check area seems to be (150,50)
but the checkbox is also the defaut size

how can I set size to CheckBox and let it looks big?

Thanks

--
Thanks & Regards,
ezioruan = {
        'email':'qiaoq...@gamil.com',
        'interests':{ 'Python',  'Linux' 'game'},
        'location':'南京',
        'website':'http://ezioandnanjing.appspot.com/',
        'note':'功名利禄身外物,知足常乐总逍遥'
        }

Tim Roberts

unread,
Jun 15, 2011, 1:15:48 PM6/15/11
to wxpytho...@googlegroups.com
阮明辉 wrote:
> Hi, I was new to wxPython , I use wxPython2.8.12.0 and python2.7.1
> I use a CheckBox , and I set it's size
>
> self.is_backup = wx.CheckBox(self.panel_up, label=u'backup',
> size=(150, 50), style=wx.SHAPED)
>
> but it seems not work , The check area seems to be (150,50)
> but the checkbox is also the defaut size
>
> how can I set size to CheckBox and let it looks big?

If you need that, you will have to do all of the drawing by hand. The
operating system always uses a fixed size for the checkboxes. There are
pure Python versions of many of the standard controls, but I'm not sure
there is a checkbox.

If you are on Windows, the check box glyphs are made up of characters
from the Marlett font, as are all of the window decorations. You can
draw characters from that font in whatever font size you want.

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Robin Dunn

unread,
Jun 15, 2011, 2:23:41 PM6/15/11
to wxpytho...@googlegroups.com
On 6/14/11 8:13 PM, 阮明辉 wrote:
> Hi, I was new to wxPython , I use wxPython2.8.12.0 and python2.7.1
> I use a CheckBox , and I set it's size
>
> self.is_backup = wx.CheckBox(self.panel_up, label=u'backup', size=(150,
> 50), style=wx.SHAPED)
>
> but it seems not work , The check area seems to be (150,50)
> but the checkbox is also the defaut size
>
> how can I set size to CheckBox and let it looks big?

The box in the native checkbox widget is drawn by the native APIs and we
have no control over the size, shape or style of the box. If you really
need this then you can create a custom checkbox widget where you draw
the box however you want it, but you'll also have to do things like
handling key and mouse events, sending checkbox events, etc.


--
Robin Dunn
Software Craftsman
http://wxPython.org

Lang Hurst

unread,
Jun 16, 2011, 3:36:36 AM6/16/11
to wxpytho...@googlegroups.com
Seems like it wouldn't be hard to make a TextCtrl do what you want.
Sort of like the attached, with some more logic and whatnot.
checkbox.py
Reply all
Reply to author
Forward
0 new messages