Python wx.GridSizer() Examples
The following are 28
code examples of wx.GridSizer().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
wx
, or try the search function
.
Example #1
Source File: websocket_server.py From IkaLog with Apache License 2.0 | 6 votes |
def on_option_tab_create(self, notebook): self.panel = wx.Panel(notebook, wx.ID_ANY) self.panel_name = _('WebSocket Server') self.layout = wx.BoxSizer(wx.VERTICAL) self.check_enable = wx.CheckBox( self.panel, wx.ID_ANY, _('Enable WebSocket Server')) self.edit_port = wx.TextCtrl(self.panel, wx.ID_ANY, 'port') layout = wx.GridSizer(2) layout.Add(wx.StaticText(self.panel, wx.ID_ANY, _('Listen port'))) layout.Add(self.edit_port) self.layout.Add(self.check_enable) self.layout.Add(wx.StaticText( self.panel, wx.ID_ANY, _('WARNING: The server is accessible by anyone.'), )) self.layout.Add(layout, flag=wx.EXPAND) self.panel.SetSizer(self.layout)
Example #2
Source File: __init__.py From EventGhost with GNU General Public License v2.0 | 6 votes |
def Configure(self, number="", msg="", service=""): panel = eg.ConfigPanel() label1Text = wx.StaticText(panel, -1, self.text.label1) label2Text = wx.StaticText(panel, -1, self.text.label2) label3Text = wx.StaticText(panel, -1, self.text.label3) textControl1 = wx.TextCtrl(panel, -1, number) textControl2 = wx.TextCtrl(panel, -1, msg) textControl3 = wx.TextCtrl(panel, -1, service) topSizer = wx.GridSizer(rows=2, cols=2) topSizer.Add(label1Text,0,wx.ALIGN_BOTTOM,0) topSizer.Add(label3Text,0,wx.ALIGN_BOTTOM,0) topSizer.Add(textControl1,0,wx.TOP,3) topSizer.Add(textControl3,0,wx.TOP,3) panel.sizer.Add(topSizer,0,wx.TOP|wx.EXPAND,0) panel.sizer.Add(label2Text,0,wx.TOP,10) panel.sizer.Add(textControl2,1,wx.EXPAND|wx.TOP,3) while panel.Affirmed(): panel.SetResult( textControl1.GetValue(), textControl2.GetValue(), textControl3.GetValue() )
Example #3
Source File: edit_sizers.py From wxGlade with MIT License | 6 votes |
def add_item(self, item, index=None): "Adds an item to self." # called from ManagedBase.__init__ when adding an item to the end from XML parser # or interactively when adding an item to an empty sizer slot # XXX unify with edit_base.EditBase.add_item if index is None: index = len(self.children) if index==len(self.children): self.children.append(None) else: old_child = self.children[index] if old_child: self.children[index].recursive_remove(0, keep_slot=True) if "rows" in self.PROPERTIES and not self._IS_GRIDBAG: self._adjust_rows_cols() # for GridSizer self.children[index] = item
Example #4
Source File: hue.py From IkaLog with Apache License 2.0 | 6 votes |
def on_option_tab_create(self, notebook): self.panel = wx.Panel(notebook, wx.ID_ANY, size=(640, 360)) self.panel_name = 'Hue' self.layout = wx.BoxSizer(wx.VERTICAL) self.panel.SetSizer(self.layout) self.checkEnable = wx.CheckBox(self.panel, wx.ID_ANY, u'Hue と連携') self.editHueHost = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge') self.editHueUsername = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge') try: layout = wx.GridSizer(2, 2) except: layout = wx.GridSizer(2) layout.Add(wx.StaticText(self.panel, wx.ID_ANY, u'ホスト')) layout.Add(self.editHueHost) layout.Add(wx.StaticText(self.panel, wx.ID_ANY, u'ユーザ')) layout.Add(self.editHueUsername) self.layout.Add(self.checkEnable) self.layout.Add(layout) # enhance_color and rgb2xy is imported from: # https://gist.githubusercontent.com/error454/6b94c46d1f7512ffe5ee/raw/73b190ce256c3d8dd540cc34e6dae43848cbce4c/gistfile1.py # All the rights belongs to the author.
Example #5
Source File: edit_sizers.py From wxGlade with MIT License | 5 votes |
def _add_slot(self, loading=False): "adds an empty slot to the sizer, i.e. a fake window that will accept the dropping of widgets" # called from "add slot" context menu handler of sizer # called from XML parser for adding empty 'sizerslot': sizer._add_slot(loading=True) slot = SizerSlot(self, len(self.children)) if "rows" in self.PROPERTIES: self._adjust_rows_cols(loading) # for GridSizer if self.widget: slot.create() return slot
Example #6
Source File: wxpython_toggle.py From R421A08-rs485-8ch-relay-board with MIT License | 5 votes |
def CreateRelayButtons(self): gSizer = wx.GridSizer(0, 2, 0, 0) # Create button 'all on' m_btnAllOn = wx.Button(self, 9, u'All on', wx.DefaultPosition, wx.DefaultSize, 0) gSizer.Add(m_btnAllOn, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) m_btnAllOn.Bind(wx.EVT_BUTTON, self.OnBtnAllOnClick) # Create button 'all off' m_btnAllOff = wx.Button(self, 10, u'All off', wx.DefaultPosition, wx.DefaultSize, 0) gSizer.Add(m_btnAllOff, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) m_btnAllOff.Bind(wx.EVT_BUTTON, self.OnBtnAllOffClick) # Create toggle buttons for relay in range(self.m_relay_board.num_relays): # Convert relay numbers to grid: First column 0..3, second column: 4..7 if relay & 1: relay = 4 + int((relay - 1) / 2) else: relay = int(relay / 2) button_text = u'Toggle ' + str(relay + 1) m_btnToggleRelay = wx.Button(self, relay, button_text, wx.DefaultPosition, wx.DefaultSize, 0) gSizer.Add(m_btnToggleRelay, 0, wx.ALL | wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL, 5) m_btnToggleRelay.Bind(wx.EVT_BUTTON, self.OnBtnToggleClick) self.SetSizer(gSizer)
Example #7
Source File: SimpleSCardAppFrame.py From pyscard with GNU Lesser General Public License v2.1 | 5 votes |
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) sizer = wx.GridSizer(1, 1) self.SetSizer(sizer) self.SetAutoLayout(True)
Example #8
Source File: EventRemapDialog.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, mapping=None): eg.Dialog.__init__( self, parent, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER ) listCtrl = wx.ListCtrl(self, -1, style=wx.LC_REPORT) listCtrl.InsertColumn(0, "New event name") listCtrl.InsertColumn(1, "Events") listCtrl.InsertColumn(2, "Repeat events") listCtrl.InsertColumn(3, "Timeout") newEventCtrl = self.TextCtrl() eventsCtrl = self.TextCtrl() repeatEventsCtrl = self.TextCtrl() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(listCtrl, 1, wx.EXPAND) editSizer = wx.GridSizer(1, 2) editSizer.Add( self.StaticText("New event name:"), wx.ALIGN_CENTER_VERTICAL ) editSizer.Add(newEventCtrl, 0) editSizer.Add( self.StaticText("Events:"), wx.ALIGN_CENTER_VERTICAL ) editSizer.Add(eventsCtrl, 0) editSizer.Add( self.StaticText("Repeat events:"), wx.ALIGN_CENTER_VERTICAL ) editSizer.Add(repeatEventsCtrl, 0) sizer.Add(editSizer) self.SetSizerAndFit(sizer)
Example #9
Source File: RadioBox.py From EventGhost with GNU General Public License v2.0 | 5 votes |
def __init__( self, parent = None, id = -1, label = "", pos = (-1, -1), size = (-1, -1), choices = (), majorDimension = 0, style = wx.RA_SPECIFY_COLS, validator = wx.DefaultValidator, name = "radioBox" ): self.value = 0 wx.Panel.__init__(self, parent, id, pos, size, name=name) sizer = self.sizer = wx.GridSizer(len(choices), 1, 6, 6) style = wx.RB_GROUP for i, choice in enumerate(choices): radioButton = wx.RadioButton(self, i, choice, style=style) style = 0 self.sizer.Add(radioButton, 0, wx.EXPAND) radioButton.Bind(wx.EVT_RADIOBUTTON, self.OnSelect) self.SetSizer(sizer) self.SetAutoLayout(True) sizer.Fit(self) self.Layout() self.SetMinSize(self.GetSize()) self.Bind(wx.EVT_SIZE, self.OnSize)
Example #10
Source File: panels.py From topoflow with MIT License | 5 votes |
def __do_layout(self): self.grid_sizer = wx.GridSizer(5, 5, 4, 4) self.grid_sizer.Add(self.label, 0, wx.FIXED_MINSIZE, 0) self.grid_sizer.Add(self.switch_panel, 0, wx.FIXED_MINSIZE, 0) self.SetAutoLayout(True) self.SetSizer(self.grid_sizer) self.grid_sizer.Fit(self) self.grid_sizer.SetSizeHints(self)
Example #11
Source File: panels.py From topoflow with MIT License | 5 votes |
def __do_layout(self): self.grid_sizer = wx.GridSizer(5, 5, 4, 4) self.grid_sizer.Add(self.label, 0, wx.FIXED_MINSIZE, 0) self.grid_sizer.Add(self.switch_panel, 0, wx.FIXED_MINSIZE, 0) self.SetAutoLayout(True) self.SetSizer(self.grid_sizer) self.grid_sizer.Fit(self) self.grid_sizer.SetSizeHints(self)
Example #12
Source File: edit_sizers.py From wxGlade with MIT License | 5 votes |
def _get_actual_rows_cols(self): rows = self.rows cols = self.cols # for GridSizer and FlexGridSizer cols may be 0, i.e. auto calculated if cols==0: cols = (len(self.children)-1)//rows + 1 elif rows==0: rows = (len(self.children)-1)//cols + 1 return rows, cols
Example #13
Source File: edit_sizers.py From wxGlade with MIT License | 5 votes |
def _create(self, rows, cols, vgap, hgap): self._grid = wx.GridSizer(rows, cols, vgap, hgap)
Example #14
Source File: edit_sizers.py From wxGlade with MIT License | 5 votes |
def child_widgets_created(self, level): # called after (all) child widgets have been created or a single one has been added if "rows" in self.PROPERTIES: self._adjust_rows_cols() # for GridSizer if not self.toplevel: return size_p = self.window.properties['size'] if not size_p.is_active(): self.fit_parent() w, h = self.widget.GetSize() postfix = '' if config.preferences.use_dialog_units: w, h = compat.ConvertPixelsToDialog( self.window.widget, self.widget.GetSize() ) postfix = 'd' size_p.set('%s, %s%s' % (w, h, postfix))
Example #15
Source File: edit_sizers.py From wxGlade with MIT License | 5 votes |
def _insert_slot(self, index=None): "Inserts an empty slot into the sizer at pos (1 based); optionally force layout update" # called from context menu handler; multiple times if applicable; layout will be called there # also called from SizerBase._remove after a sizer has removed itself and inserts an empty slot instead if index>=len(self.children) or not self.children[index] is None: self.children.insert( index, None) # placeholder to be overwritten slot = SizerSlot(self, index) if "rows" in self.PROPERTIES: self._adjust_rows_cols() # for GridSizer if self.widget: slot.create() return slot # insert/add slot callbacks for context menus ######################################################################
Example #16
Source File: fluentd.py From IkaLog with Apache License 2.0 | 5 votes |
def on_option_tab_create(self, notebook): self.panel = wx.Panel(notebook, wx.ID_ANY, size=(640, 360)) self.panel_name = 'Fluentd' self.layout = wx.BoxSizer(wx.VERTICAL) self.checkEnable = wx.CheckBox( self.panel, wx.ID_ANY, u'Fluentd へ戦績を送信する') self.editHost = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge') self.editPort = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge') self.editTag = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge') self.editUsername = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge') try: layout = wx.GridSizer(2, 4) except: layout = wx.GridSizer(2) layout.Add(wx.StaticText(self.panel, wx.ID_ANY, u'ホスト')) layout.Add(self.editHost) layout.Add(wx.StaticText(self.panel, wx.ID_ANY, u'ポート')) layout.Add(self.editPort) layout.Add(wx.StaticText(self.panel, wx.ID_ANY, u'タグ')) layout.Add(self.editTag) layout.Add(wx.StaticText(self.panel, wx.ID_ANY, u'ユーザ名')) layout.Add(self.editUsername) self.layout.Add(self.checkEnable) self.layout.Add(layout) self.panel.SetSizer(self.layout) ## # Log a record to Fluentd. # @param self The Object Pointer. # @param recordType Record Type (tag) # @param record Record #
Example #17
Source File: bug194.py From wxGlade with MIT License | 5 votes |
def __init__(self, *args, **kwds): # begin wxGlade: Frame194.__init__ kwds["style"] = kwds.get("style", 0) wx.Frame.__init__(self, *args, **kwds) self.SetSize((800, 600)) self.SetTitle(_("frame_1")) sizer_1 = wx.GridSizer(2, 3, 0, 0) self.list_box_single = wx.ListBox(self, wx.ID_ANY, choices=[_("Listbox wxLB_SINGLE")]) self.list_box_single.SetSelection(0) sizer_1.Add(self.list_box_single, 1, wx.ALL | wx.EXPAND, 5) self.list_box_multiple = wx.ListBox(self, wx.ID_ANY, choices=[_("Listbox wxLB_MULTIPLE")], style=wx.LB_MULTIPLE) self.list_box_multiple.SetSelection(0) sizer_1.Add(self.list_box_multiple, 1, wx.ALL | wx.EXPAND, 5) self.list_box_extended = wx.ListBox(self, wx.ID_ANY, choices=[_("Listbox wxLB_EXTENDED")], style=wx.LB_EXTENDED) self.list_box_extended.SetSelection(0) sizer_1.Add(self.list_box_extended, 1, wx.ALL | wx.EXPAND, 5) self.check_list_box_single = wx.CheckListBox(self, wx.ID_ANY, choices=[_("CheckListBox wxLB_SINGLE")], style=wx.LB_SINGLE) self.check_list_box_single.SetSelection(0) sizer_1.Add(self.check_list_box_single, 1, wx.ALL | wx.EXPAND, 5) self.check_list_box_multiple = wx.CheckListBox(self, wx.ID_ANY, choices=[_("CheckListBox wxLB_MULTIPLE")], style=wx.LB_MULTIPLE) self.check_list_box_multiple.SetSelection(0) sizer_1.Add(self.check_list_box_multiple, 1, wx.ALL | wx.EXPAND, 5) self.check_list_box_extended = wx.CheckListBox(self, wx.ID_ANY, choices=[_("CheckListBox wxLB_EXTENDED")], style=wx.LB_EXTENDED) self.check_list_box_extended.SetSelection(0) sizer_1.Add(self.check_list_box_extended, 1, wx.ALL | wx.EXPAND, 5) self.SetSizer(sizer_1) self.Layout() # end wxGlade # end of class Frame194
Example #18
Source File: radio_box.py From wxGlade with MIT License | 5 votes |
def _do_layout(self): "Lays out the radio buttons according to the values of self.style and self.major_dim" if not self.widget: return buttons_layout = self.buttons if self.dimension: if self.style & wx.RA_SPECIFY_COLS: cols = self.dimension rows = 0 else: cols = 0 rows = self.dimension sizer = wx.GridSizer(rows, cols, 0, 0) if wx.Platform == '__WXGTK__': # we need to reorder self.buttons 'cos wxRadioBox lays out its # elements by colums, while wxGridSizer by rows import math if not rows: step = int(math.ceil(1.0*len(self.buttons)/cols)) else: step = rows tmp = [[] for i in range(step)] for i, button in enumerate(self.buttons): tmp[i%step].append(button) buttons_layout = [] for t in tmp: buttons_layout.extend(t) else: sizer = wx.BoxSizer(wx.VERTICAL) for button in buttons_layout: w, h = button.GetBestSize() sizer.Add(button, 0, wx.EXPAND) sizer.SetItemMinSize(button, w, h) self.widget.SetAutoLayout(True) sb_sizer = wx.StaticBoxSizer(self.static_box, wx.VERTICAL) self.widget.SetSizer(sb_sizer) sb_sizer.Add(sizer, 1, wx.EXPAND) sb_sizer.SetMinSize(sizer.GetMinSize()) sb_sizer.Fit(self.widget) if hasattr(self.parent, "set_item_best_size"): self.parent.set_item_best_size(self, size=self.widget.GetBestSize())
Example #19
Source File: DialogUtils.py From kicad_mmccoo with Apache License 2.0 | 5 votes |
def __init__(self, parent, layers=None, cols=4): wx.Window.__init__(self, parent, wx.ID_ANY) if (layers == None): layers = ['F.Cu', 'F.Silks','Edge.Cuts', 'F.Mask', 'B.Cu', 'B.SilkS','Cmts.User', 'B.Mask'] sizer = wx.GridSizer(cols=cols)#, hgap=5, vgap=5) self.SetSizer(sizer) board = pcbnew.GetBoard() self.layertable = {} numlayers = pcbnew.PCB_LAYER_ID_COUNT for i in range(numlayers): self.layertable[board.GetLayerName(i)] = i for layername in layers: if (layername not in self.layertable): ValueError("layer {} doesn't exist".format(layername)) if (layername == layers[0]): rb = wx.RadioButton(self, label=layername, style=wx.RB_GROUP) self.value = layername self.valueint = self.layertable[layername] else: rb = wx.RadioButton(self, label=layername) rb.Bind(wx.EVT_RADIOBUTTON, self.OnButton) sizer.Add(rb)
Example #20
Source File: DialogUtils.py From kicad_mmccoo with Apache License 2.0 | 5 votes |
def __init__(self, parent, singleton=True, cols=1): wx.Window.__init__(self, parent, wx.ID_ANY) self.singleton = singleton self.boxes = [] self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) self.buttonwin = wx.Window(self) self.buttonsizer = wx.BoxSizer(wx.HORIZONTAL) self.buttonwin.SetSizer(self.buttonsizer) self.sizer.Add(self.buttonwin) if (not singleton): self.value = Set() self.selectall = wx.Button(self.buttonwin, label="select all"); self.selectall.Bind(wx.EVT_BUTTON, self.OnSelectAllNone) self.buttonsizer.Add(self.selectall) self.selectnone = wx.Button(self.buttonwin, label="select none"); self.selectnone.Bind(wx.EVT_BUTTON, self.OnSelectAllNone) self.buttonsizer.Add(self.selectnone) self.scrolled = wx.ScrolledWindow(self, wx.ID_ANY) self.sizer.Add(self.scrolled, proportion=1, flag=wx.EXPAND|wx.ALL) fontsz = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPixelSize() self.scrolled.SetScrollRate(fontsz.x, fontsz.y) self.scrollsizer = wx.GridSizer(cols=cols, hgap=5, vgap=5) self.scrolled.SetSizer(self.scrollsizer)
Example #21
Source File: TicTacToeGuiApp.py From advancedpython3 with GNU General Public License v3.0 | 5 votes |
def setup_display(self): # Create the panel to contain the widgets panel = wx.Panel(self) # Create the GridSizer to use with the Panel grid_sizer = wx.GridSizer(3, 3, 1, 1) panel.SetSizer(grid_sizer) for row_position in range(0, 3): row = [] for col_position in range(0, 3): button = TicTacToeButton(panel, label=' ', row=row_position, col=col_position) button.Bind(wx.EVT_BUTTON, self.button_handler) row.append(button) grid_sizer.Add(button) self.button_grid.append(row)
Example #22
Source File: boyomi.py From IkaLog with Apache License 2.0 | 5 votes |
def on_option_tab_create(self, notebook): self.panel = wx.Panel(notebook, wx.ID_ANY) self.panel_name = _('Boyomi') self.layout = wx.BoxSizer(wx.VERTICAL) self.check_enable = wx.CheckBox( self.panel, wx.ID_ANY, _('Enable Boyomi client')) self.edit_host = wx.TextCtrl(self.panel, wx.ID_ANY, 'host') self.edit_port = wx.TextCtrl(self.panel, wx.ID_ANY, 'port') self.button_test = wx.Button(self.panel, wx.ID_ANY, _('Test intergration')) try: layout = wx.GridSizer(2, 4) except: layout = wx.GridSizer(2) layout.Add(wx.StaticText(self.panel, wx.ID_ANY, _('host'))) layout.Add(self.edit_host) layout.Add(wx.StaticText(self.panel, wx.ID_ANY, _('port'))) layout.Add(self.edit_port) self.layout.Add(self.check_enable) self.layout.Add(layout, flag=wx.EXPAND) self.layout.Add(self.button_test) self.panel.SetSizer(self.layout) self.button_test.Bind(wx.EVT_BUTTON, self.on_test_button_click)
Example #23
Source File: Main_Dialog_OLD.py From topoflow with MIT License | 4 votes |
def Get_Navigation_Panel(self): #---------------------------------- # Create a new panel with a sizer #---------------------------------- panel = wx.Panel(self) panel.SetBackgroundColour('Light Blue') self.navigation_panel = panel sizer = wx.GridSizer(2, 2, self.hgap, self.vgap) panel.SetSizer(sizer) #----------------------------------- # Can we find the button bitmaps ? #----------------------------------- #------------------------- # Get the button bitmaps #------------------------- bmp_nx = 168 bmp_ny = 128 bmp_file1 = self.bmp_dir + "TF_Button1.bmp" bmp_file2 = self.bmp_dir + "TF_Button2.bmp" bmp_file3 = self.bmp_dir + "TF_Button3.bmp" bmp_file4 = self.bmp_dir + "TF_Button4.bmp" bmp1 = wx.Image(bmp_file1, wx.BITMAP_TYPE_BMP).ConvertToBitmap() bmp2 = wx.Image(bmp_file2, wx.BITMAP_TYPE_BMP).ConvertToBitmap() bmp3 = wx.Image(bmp_file3, wx.BITMAP_TYPE_BMP).ConvertToBitmap() bmp4 = wx.Image(bmp_file4, wx.BITMAP_TYPE_BMP).ConvertToBitmap() #----------------------------------------------------------------- new_button = wx.BitmapButton(panel, -1, bmp1) pre_button = wx.BitmapButton(panel, -1, bmp2) plot_button = wx.BitmapButton(panel, -1, bmp3) exit_button = wx.BitmapButton(panel, -1, bmp4) #----------------------------------------------------------------- proportion = 0 flag = wx.ALIGN_CENTER # (affects resizing by user) border = 10 sizer.Add(new_button, proportion, flag, border) sizer.Add(pre_button, proportion, flag, border) sizer.Add(plot_button, proportion, flag, border) sizer.Add(exit_button, proportion, flag, border) #------------------------------------------------------------------ self.Bind(wx.EVT_BUTTON, self.On_Goto_New_Run, new_button) self.Bind(wx.EVT_BUTTON, self.On_Goto_Preprocessing, pre_button) self.Bind(wx.EVT_BUTTON, self.On_Goto_Plotting, plot_button) self.Bind(wx.EVT_BUTTON, self.On_File_Exit, exit_button) #------------------------------------ # Main panel is displayed at start, # but other panels are hidden #------------------------------------ sizer.Fit(self) panel.Show() ## sizer.Show(True) # (also works) # Get_Navigation_Panel() #----------------------------------------------------------------
Example #24
Source File: Bling.py From BitTorrent with GNU General Public License v3.0 | 4 votes |
def __init__(self, parent, *a, **k): wx.Panel.__init__(self, parent, *a, **k) self.stats = {} self.sizer = wx.BoxSizer(wx.HORIZONTAL) self.scrolled_window = wx.ScrolledWindow(self) self.scrolled_window.SetScrollRate(1, 1) self.sizer.Add(self.scrolled_window, flag=wx.GROW, proportion=1) self.scroll_sizer = wx.BoxSizer(wx.HORIZONTAL) self.panel = wx.Panel(self.scrolled_window) self.scroll_sizer.Add(self.panel, flag=wx.GROW, proportion=1) self.outer = wx.BoxSizer(wx.HORIZONTAL) self.left = wx.GridSizer(6, 2, SPACING, SPACING) self.outer.Add(self.left, flag=wx.ALL, border=SPACING) self.right = wx.GridSizer(6, 2, SPACING, SPACING) self.outer.Add(self.right, flag=wx.ALL, border=SPACING) self.add_row(self.left, "total_downrate", _("Total Download Rate:")) self.add_row(self.left, "total_uprate", _("Total Upload Rate:")) self.add_blank_row(self.left) self.add_row(self.left, "total_downtotal", _("Total Downloaded:")) self.add_row(self.left, "total_uptotal", _("Total Uploaded:")) self.add_row(self.right, "num_torrents", _("Torrents:")) self.add_row(self.right, "num_running_torrents", _("Running Torrents:")) self.add_blank_row(self.right) self.add_row(self.right, "num_connections", _("Total Connections:")) self.add_row(self.right, "avg_connections", _("Connections per Torrent:")) self.panel.SetSizerAndFit(self.outer) self.scrolled_window.SetSizer(self.scroll_sizer) self.SetSizerAndFit(self.sizer) # this fixes background repaint issues on XP w/ themes def OnSize(event): self.Refresh() event.Skip() self.Bind(wx.EVT_SIZE, OnSize)
Example #25
Source File: Main_Dialog.py From topoflow with MIT License | 4 votes |
def Add_Navigation_Panel(self): #---------------------------------- # Create a new panel with a sizer #---------------------------------- panel = self.main_panel hgap = 20 vgap = 15 sizer = wx.GridSizer(2, 2, hgap, vgap) self.navigation_sizer = sizer #----------------------------------- # Can we find the button bitmaps ? #----------------------------------- #------------------------- # Get the button bitmaps #------------------------- bmp_nx = 168 bmp_ny = 128 bmp_file1 = self.bmp_dir + "TF_Button1.bmp" bmp_file2 = self.bmp_dir + "TF_Button2.bmp" bmp_file3 = self.bmp_dir + "TF_Button3.bmp" bmp_file4 = self.bmp_dir + "TF_Button4.bmp" bmp1 = wx.Image(bmp_file1, wx.BITMAP_TYPE_BMP).ConvertToBitmap() bmp2 = wx.Image(bmp_file2, wx.BITMAP_TYPE_BMP).ConvertToBitmap() bmp3 = wx.Image(bmp_file3, wx.BITMAP_TYPE_BMP).ConvertToBitmap() bmp4 = wx.Image(bmp_file4, wx.BITMAP_TYPE_BMP).ConvertToBitmap() #----------------------------------------------------------------- new_button = wx.BitmapButton(panel, -1, bmp1) pre_button = wx.BitmapButton(panel, -1, bmp2) plot_button = wx.BitmapButton(panel, -1, bmp3) exit_button = wx.BitmapButton(panel, -1, bmp4) #----------------------------------------------------------------- proportion = 0 # flag = wx.ALIGN_CENTER # (affects resizing by user) flag = wx.ALL border = 20 sizer.Add(new_button, proportion, flag, border) sizer.Add(pre_button, proportion, flag, border) sizer.Add(plot_button, proportion, flag, border) sizer.Add(exit_button, proportion, flag, border) #------------------------------------------------------------------ self.Bind(wx.EVT_BUTTON, self.On_Goto_Run_Info, new_button) self.Bind(wx.EVT_BUTTON, self.On_Goto_Preprocessing, pre_button) self.Bind(wx.EVT_BUTTON, self.On_Goto_Plotting, plot_button) self.Bind(wx.EVT_BUTTON, self.On_File_Exit, exit_button) #--------------------------------------- # Add run_info_sizer to the main_sizer #--------------------------------------- self.main_sizer.Add(sizer, 0, wx.ALL, self.vgap) self.main_sizer.Hide(sizer) # Add_Navigation_Panel() #----------------------------------------------------------------
Example #26
Source File: BirthdayGUIApp.py From advancedpython3 with GNU General Public License v3.0 | 4 votes |
def __init__(self): super().__init__(parent=None, title='Happy Birthday App', size=(300, 200)) self.name = '<unknown' self.age = -1 # Create the BoxSizer to use for the Frame vertical_box_sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vertical_box_sizer) # Create the panel to contain the widgets panel = wx.Panel(self) # Add the Panel to the Frames Sizer vertical_box_sizer.Add(panel, wx.ID_ANY, wx.EXPAND | wx.ALL, 20) # Create the GridSizer to use with the Panel grid = wx.GridSizer(5, 1, 5, 5) # Create a Panel to hold the name label and input field widgets name_panel = wx.Panel(panel) horizontal_box_sizer = wx.BoxSizer(wx.HORIZONTAL) name_panel.SetSizer(horizontal_box_sizer) horizontal_box_sizer.Add(wx.StaticText(name_panel, label='Name: ')) self.name_texttrl = wx.TextCtrl(name_panel, size=(150, -1)) horizontal_box_sizer.Add(self.name_texttrl) # Create a panel for the age label and input field age_panel = wx.Panel(panel) horizontal_box_sizer2 = wx.BoxSizer(wx.HORIZONTAL) age_panel.SetSizer(horizontal_box_sizer2) horizontal_box_sizer2.Add(wx.StaticText(age_panel, label='Age: ')) self.age_textctrl = wx.TextCtrl(age_panel, size=(150, -1)) horizontal_box_sizer2.Add(self.age_textctrl) # Now configure the enter button enter_button = wx.Button(panel, label='Enter') enter_button.Bind(wx.EVT_BUTTON, self.set_name_and_age) # Next set up the text label self.label = wx.StaticText(panel, label='Welcome', style=wx.ALIGN_LEFT) # Now configure the Show Message button message_button = wx.Button(panel, label='Birthday') message_button.Bind(wx.EVT_BUTTON, self.show_birthday_message) # Add all the widgets to the grid sizer to handle layout grid.AddMany([name_panel, age_panel, enter_button, self.label, message_button]) # Set the sizer on the panel panel.SetSizer(grid) # Centre the Frame on the Computer Screen self.Centre()
Example #27
Source File: HelloNamedApp.py From advancedpython3 with GNU General Public License v3.0 | 4 votes |
def __init__(self, title): super().__init__(None, title=title, size=(300, 200)) self.name = '<unknown>' # Create the BoxSizer to use for the Frame vertical_box_sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vertical_box_sizer) # Create the panel to contain the widgets panel = wx.Panel(self) # Add the Panel to the Frames Sizer vertical_box_sizer.Add(panel, wx.ID_ANY, wx.EXPAND | wx.ALL, 20) # Create the GridSizer to use with the Panel grid = wx.GridSizer(4, 1, 5, 5) # Set up the input field self.text = wx.TextCtrl(panel, size=(150, -1)) # Now configure the enter button enter_button = wx.Button(panel, label='Enter') enter_button.Bind(wx.EVT_BUTTON, self.set_name) # Next set up the text label self.label = wx.StaticText(panel, label='Welcome', style=wx.ALIGN_LEFT) # Now configure the Show Message button message_button = wx.Button(panel, label='Show Message') message_button.Bind(wx.EVT_BUTTON, self.show_message) # Add all the widgets to the grid sizer to handle layout grid.AddMany([self.text, enter_button, self.label, message_button]) # Set the sizer on the panel panel.SetSizer(grid) # Centre the Frame on the Computer Screen self.Centre()
Example #28
Source File: configuration_dialogs.py From superpaper with MIT License | 4 votes |
def __init__(self, parent, parent_tray_obj): wx.Panel.__init__(self, parent) self.frame = parent self.parent_tray_obj = parent_tray_obj self.sizer_main = wx.BoxSizer(wx.VERTICAL) self.sizer_grid_settings = wx.GridSizer(6, 2, 5, 5) self.sizer_buttons = wx.BoxSizer(wx.HORIZONTAL) pnl = self st_logging = wx.StaticText(pnl, -1, "Logging") st_usehotkeys = wx.StaticText(pnl, -1, "Use hotkeys") st_warn_large = wx.StaticText(pnl, -1, "Large image warning") st_hk_next = wx.StaticText(pnl, -1, "Hotkey: Next wallpaper") st_hk_pause = wx.StaticText(pnl, -1, "Hotkey: Pause slideshow") st_setcmd = wx.StaticText(pnl, -1, "Custom command") self.cb_logging = wx.CheckBox(pnl, -1, "") self.cb_usehotkeys = wx.CheckBox(pnl, -1, "") self.cb_warn_large = wx.CheckBox(pnl, -1, "") self.tc_hk_next = wx.TextCtrl(pnl, -1, size=(200, -1)) self.tc_hk_pause = wx.TextCtrl(pnl, -1, size=(200, -1)) self.tc_setcmd = wx.TextCtrl(pnl, -1, size=(200, -1)) self.sizer_grid_settings.AddMany( [ (st_logging, 0, wx.ALIGN_RIGHT), (self.cb_logging, 0, wx.ALIGN_LEFT), (st_usehotkeys, 0, wx.ALIGN_RIGHT), (self.cb_usehotkeys, 0, wx.ALIGN_LEFT), (st_warn_large, 0, wx.ALIGN_RIGHT), (self.cb_warn_large, 0, wx.ALIGN_LEFT), (st_hk_next, 0, wx.ALIGN_RIGHT), (self.tc_hk_next, 0, wx.ALIGN_LEFT), (st_hk_pause, 0, wx.ALIGN_RIGHT), (self.tc_hk_pause, 0, wx.ALIGN_LEFT), (st_setcmd, 0, wx.ALIGN_RIGHT), (self.tc_setcmd, 0, wx.ALIGN_LEFT), ] ) self.update_fields() self.button_save = wx.Button(self, label="Save") self.button_close = wx.Button(self, label="Close") self.button_save.Bind(wx.EVT_BUTTON, self.onSave) self.button_close.Bind(wx.EVT_BUTTON, self.onClose) self.sizer_buttons.AddStretchSpacer() self.sizer_buttons.Add(self.button_save, 0, wx.ALL, 5) self.sizer_buttons.Add(self.button_close, 0, wx.ALL, 5) self.sizer_main.Add(self.sizer_grid_settings, 0, wx.CENTER|wx.EXPAND|wx.ALL, 5) self.sizer_main.Add(self.sizer_buttons, 0, wx.EXPAND) self.SetSizer(self.sizer_main) self.sizer_main.Fit(parent)