本文整理汇总了Python中wx.GridSizer方法的典型用法代码示例。如果您正苦于以下问题:Python wx.GridSizer方法的具体用法?Python wx.GridSizer怎么用?Python wx.GridSizer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.GridSizer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_option_tab_create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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)
示例2: on_option_tab_create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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.
示例3: add_item
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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
示例4: Configure
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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()
)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
sizer = wx.GridSizer(1, 1)
self.SetSizer(sizer)
self.SetAutoLayout(True)
示例6: on_option_tab_create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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
#
示例7: on_option_tab_create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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)
示例8: setup_display
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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)
示例10: _do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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())
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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
示例12: _add_slot
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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
示例13: _insert_slot
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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 ######################################################################
示例14: child_widgets_created
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
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))
示例15: _create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import GridSizer [as 别名]
def _create(self, rows, cols, vgap, hgap):
self._grid = wx.GridSizer(rows, cols, vgap, hgap)