Created
November 3, 2017 14:19
-
-
Save driscollis/6e36b4ba65bd0472761bc3ca83522d6f to your computer and use it in GitHub Desktop.
7x24 group of check boxes in wxPython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import wx | |
| class MainPanel(wx.Panel): | |
| def __init__(self, parent): | |
| wx.Panel.__init__(self, parent) | |
| main_sizer = wx.BoxSizer(wx.VERTICAL) | |
| for row in range(7): | |
| row_sizer = wx.BoxSizer(wx.HORIZONTAL) | |
| for col in range(24): | |
| name_of_checkbox = "row_{row}_col_{col}".format( | |
| row=row, col=col) | |
| checkbox = wx.CheckBox(self, name=name_of_checkbox) | |
| row_sizer.Add(checkbox, 0, wx.ALL, 5) | |
| main_sizer.Add(row_sizer) | |
| self.SetSizer(main_sizer) | |
| class MainFrame(wx.Frame): | |
| def __init__(self): | |
| wx.Frame.__init__(self, None, title='Checks', size=(800, 400)) | |
| panel = MainPanel(self) | |
| self.Show() | |
| if __name__ == '__main__': | |
| app = wx.App() | |
| frame = MainFrame() | |
| app.MainLoop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment