File: wx.lib.checkbox.txt

package info (click to toggle)
wxpython4.0 4.2.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 232,540 kB
  • sloc: cpp: 958,937; python: 233,059; ansic: 150,441; makefile: 51,662; sh: 8,687; perl: 1,563; javascript: 584; php: 326; xml: 200
file content (90 lines) | stat: -rw-r--r-- 3,188 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2020 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. module:: wx.lib.checkbox

.. currentmodule:: wx.lib.checkbox

.. highlight:: python



.. _wx.lib.checkbox:

==========================================================================================================================================
|phoenix_title|  **wx.lib.checkbox**
==========================================================================================================================================

This module implements various forms of generic checkboxes, meaning that
they are not built on native controls but are self-drawn.


Description
===========

This module implements various forms of generic checkboxes, meaning that
they are not built on native controls but are self-drawn.
They should act like normal checkboxes but you are able to better control how they look, etc...


Usage
=====

Sample usage::

    app = wx.App(redirect=False)
    class MyFrame(wx.Frame, DefineNativeCheckBoxBitmapsMixin):
        def __init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString,
                     pos=wx.DefaultPosition, size=wx.DefaultSize,
                     style=wx.DEFAULT_FRAME_STYLE, name='frame'):
            wx.Frame.__init__(self, parent, id, title, pos, size, style, name)
            ## self.DefineNativeCheckBoxBitmaps()
            ## self.checkbox_bitmaps = self.GetNativeCheckBoxBitmaps()
            cb1 = GenCheckBox(self, label="PurePython Checkbox1", pos=(10, 10))
            cb2 = GenCheckBox(self, label="PurePython Checkbox2", pos=(10, 50))
            cb1.Bind(wx.EVT_CHECKBOX, self.OnCheckBox)
            cb2.Bind(wx.EVT_CHECKBOX, self.OnCheckBox)
            cb2.SetForegroundColour(wx.GREEN)
            cb2.SetBackgroundColour(wx.BLACK)
            sizer = wx.BoxSizer()
            sizer.Add(cb1, 0, wx.ALL, 5)
            sizer.Add(cb2, 0, wx.ALL, 5)
            self.SetSizer(sizer)

        def OnCheckBox(self, event):
            evtObj = event.GetEventObject()
            print(evtObj.GetLabel(), evtObj.IsChecked())

    frame = MyFrame(None, wx.ID_ANY, "Test Pure-Py Checkbox")
    frame.Show()
    app.MainLoop()


|class_summary| Classes Summary
===============================

================================================================================ ================================================================================
:ref:`~wx.lib.checkbox.DefineNativeCheckBoxBitmapsMixin`                         Inherit this mixin in your :class:`wx.Window` based subclass to easily
:ref:`~wx.lib.checkbox.GenCheckBox`                                              A generic class that replicates some of the functionalities of :class:`wx.Checkbox`,
================================================================================ ================================================================================


|


.. toctree::
   :maxdepth: 1
   :hidden:

   wx.lib.checkbox.DefineNativeCheckBoxBitmapsMixin
   wx.lib.checkbox.GenCheckBox