本文整理汇总了Python中wx.BoxSizer方法的典型用法代码示例。如果您正苦于以下问题:Python wx.BoxSizer方法的具体用法?Python wx.BoxSizer怎么用?Python wx.BoxSizer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.BoxSizer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def __init__(self, parent, text, title):
wx.Dialog.__init__(self, parent, -1, title,
style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
vsizer = wx.BoxSizer(wx.VERTICAL)
tc = wx.TextCtrl(self, -1, size = wx.Size(400, 200),
style = wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_LINEWRAP)
tc.SetValue(text)
vsizer.Add(tc, 1, wx.EXPAND);
vsizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
okBtn = gutil.createStockButton(self, "OK")
vsizer.Add(okBtn, 0, wx.ALIGN_CENTER)
util.finishWindow(self, vsizer)
wx.EVT_BUTTON(self, okBtn.GetId(), self.OnOK)
okBtn.SetFocus()
示例2: _do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def _do_layout(self):
self.SetDoubleBuffered(True)
self.SetBackgroundColour('#f2f2f2')
self.SetSize((180, 0))
self.SetMinSize((180, 0))
STD_LAYOUT = (0, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
container = wx.BoxSizer(wx.VERTICAL)
container.AddSpacer(15)
container.Add(wx_util.h1(self, 'Actions'), *STD_LAYOUT)
container.AddSpacer(5)
self.listbox = wx.ListBox(self, -1)
container.Add(self.listbox, 1, wx.LEFT | wx.RIGHT | wx.EXPAND, 10)
container.AddSpacer(20)
self.SetSizer(container)
self.Bind(wx.EVT_LISTBOX, self.selection_change, self.listbox)
示例3: _do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def _do_layout(self):
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.head_panel, 0, wx.EXPAND)
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
if self.layout_type == layouts.COLUMN:
self.config_panel = layouts.ColumnLayout(self)
else:
self.config_panel = layouts.FlatLayout(self)
sizer.Add(self.config_panel, 1, wx.EXPAND)
sizer.Add(self.runtime_display, 1, wx.EXPAND)
self.runtime_display.Hide()
sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
sizer.Add(self.foot_panel, 0, wx.EXPAND)
self.SetSizer(sizer)
self.sizer = sizer
示例4: build
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def build(self, parent, data, choices=None):
self.parent = parent
self.widget = wx.TextCtrl(self.parent)
self.widget.AppendText('')
self.widget.SetMinSize((0, -1))
dt = FileDrop(self.widget)
self.widget.SetDropTarget(dt)
self.button = wx.Button(self.parent, label=self.button_text, size=(73, 23))
widget_sizer = wx.BoxSizer(wx.HORIZONTAL)
widget_sizer.Add(self.widget, 1, wx.EXPAND)
widget_sizer.AddSpacer(10)
widget_sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
parent.Bind(wx.EVT_BUTTON, self.on_button, self.button)
return widget_sizer
示例5: do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def do_layout(self, parent, title, msg):
self.panel = wx.Panel(parent)
self.widget_pack = self.widget_class()
self.title = self.format_title(self.panel, title)
self.help_msg = self.format_help_msg(self.panel, msg)
self.help_msg.SetMinSize((0, -1))
core_widget_set = self.widget_pack.build(self.panel, {}, self.choices)
vertical_container = wx.BoxSizer(wx.VERTICAL)
vertical_container.Add(self.title)
vertical_container.AddSpacer(2)
if self.help_msg.GetLabelText():
vertical_container.Add(self.help_msg, 1, wx.EXPAND)
vertical_container.AddSpacer(2)
else:
vertical_container.AddStretchSpacer(1)
vertical_container.Add(core_widget_set, 0, wx.EXPAND)
self.panel.SetSizer(vertical_container)
return self.panel
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def __init__(self, parent, ctrl):
wx.Dialog.__init__(self, parent, -1, "Character map")
self.ctrl = ctrl
hsizer = wx.BoxSizer(wx.HORIZONTAL)
self.charMap = MyCharMap(self)
hsizer.Add(self.charMap)
self.insertButton = wx.Button(self, -1, " Insert character ")
hsizer.Add(self.insertButton, 0, wx.ALL, 10)
wx.EVT_BUTTON(self, self.insertButton.GetId(), self.OnInsert)
gutil.btnDblClick(self.insertButton, self.OnInsert)
util.finishWindow(self, hsizer, 0)
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def __init__(self, parent, id):
wx.Panel.__init__(
self, parent, id,
# wxMSW/Windows does not seem to support
# wx.NO_BORDER, which sucks
style = wx.WANTS_CHARS | wx.NO_BORDER)
hsizer = wx.BoxSizer(wx.HORIZONTAL)
self.scrollBar = wx.ScrollBar(self, -1, style = wx.SB_VERTICAL)
self.ctrl = MyCtrl(self, -1)
hsizer.Add(self.ctrl, 1, wx.EXPAND)
hsizer.Add(self.scrollBar, 0, wx.EXPAND)
wx.EVT_COMMAND_SCROLL(self, self.scrollBar.GetId(),
self.ctrl.OnScroll)
wx.EVT_SET_FOCUS(self.scrollBar, self.OnScrollbarFocus)
self.SetSizer(hsizer)
# we never want the scrollbar to get the keyboard focus, pass it on to
# the main widget
示例8: doLayout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def doLayout(self):
boxSizer = wx.BoxSizer(orient=wx.HORIZONTAL)
gridSizer = wx.FlexGridSizer(rows=3, cols=2, vgap=10, hgap=10)
# Prepare some reusable arguments for calling sizer.Add():
expandOption = dict(flag=wx.EXPAND)
noOptions = dict()
emptySpace = ((0, 0), noOptions)
# Add the controls to the sizers:
for control, options in \
[(self.flagLabel, noOptions),
emptySpace,
(self.flagsRadioBox, noOptions),
(self.commentText, expandOption),
(self.okButton, dict(flag=wx.ALIGN_CENTER)),
(self.closeButton, dict(flag=wx.ALIGN_CENTER))]:
gridSizer.Add(control, **options)
for control, options in \
[(gridSizer, dict(border=5, flag=wx.ALL))]:
boxSizer.Add(control, **options)
self.SetSizerAndFit(boxSizer)
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def __init__(self):
wx.Frame.__init__(self, None,
pos=wx.DefaultPosition, size=wx.Size(450, 100),
style=wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION |
wx.CLOSE_BOX | wx.CLIP_CHILDREN,
title="BRUNO")
panel = wx.Panel(self)
ico = wx.Icon('boy.ico', wx.BITMAP_TYPE_ICO)
self.SetIcon(ico)
my_sizer = wx.BoxSizer(wx.VERTICAL)
lbl = wx.StaticText(panel,
label="Bienvenido Sir. How can I help you?")
my_sizer.Add(lbl, 0, wx.ALL, 5)
self.txt = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER,
size=(400, 30))
self.txt.SetFocus()
self.txt.Bind(wx.EVT_TEXT_ENTER, self.OnEnter)
my_sizer.Add(self.txt, 0, wx.ALL, 5)
panel.SetSizer(my_sizer)
self.Show()
speak.Speak('''Welcome back Sir, Broono at your service.''')
示例10: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def __init__(self, parent=None, id=wx.ID_ANY):
super().__init__(parent, id)
sizer = wx.BoxSizer(wx.HORIZONTAL)
# Translators: The label of an edit field in connect dialog to enter name or address of the remote computer.
sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Host:")))
self.host = wx.TextCtrl(self, wx.ID_ANY)
sizer.Add(self.host)
# Translators: Label of the edit field to enter key (password) to secure the remote connection.
sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Key:")))
self.key = wx.TextCtrl(self, wx.ID_ANY)
sizer.Add(self.key)
# Translators: The button used to generate a random key/password.
self.generate_key = wx.Button(parent=self, label=_("&Generate Key"))
self.generate_key.Bind(wx.EVT_BUTTON, self.on_generate_key)
sizer.Add(self.generate_key)
self.SetSizerAndFit(sizer)
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def __init__(self, targetfig):
wx.Frame.__init__(self, None, -1, "Configure subplots")
toolfig = Figure((6,3))
canvas = FigureCanvasWx(self, -1, toolfig)
# Create a figure manager to manage things
figmgr = FigureManager(canvas, 1, self)
# Now put all into a sizer
sizer = wx.BoxSizer(wx.VERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(canvas, 1, wx.LEFT|wx.TOP|wx.GROW)
self.SetSizer(sizer)
self.Fit()
tool = SubplotTool(targetfig, toolfig)
示例12: configure_subplots
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def configure_subplots(self, evt):
frame = wx.Frame(None, -1, "Configure subplots")
toolfig = Figure((6,3))
canvas = self.get_canvas(frame, toolfig)
# Create a figure manager to manage things
figmgr = FigureManager(canvas, 1, frame)
# Now put all into a sizer
sizer = wx.BoxSizer(wx.VERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(canvas, 1, wx.LEFT|wx.TOP|wx.GROW)
frame.SetSizer(sizer)
frame.Fit()
tool = SubplotTool(self.canvas.figure, toolfig)
frame.Show()
示例13: configure_subplots
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def configure_subplots(self, evt):
global FigureManager # placates pyflakes: created by @_Backend.export
frame = wx.Frame(None, -1, "Configure subplots")
_set_frame_icon(frame)
toolfig = Figure((6, 3))
canvas = self.get_canvas(frame, toolfig)
# Create a figure manager to manage things
FigureManager(canvas, 1, frame)
# Now put all into a sizer
sizer = wx.BoxSizer(wx.VERTICAL)
# This way of adding to sizer allows resizing
sizer.Add(canvas, 1, wx.LEFT | wx.TOP | wx.GROW)
frame.SetSizer(sizer)
frame.Fit()
SubplotTool(self.canvas.figure, toolfig)
frame.Show()
示例14: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def __init__(self, parent, help_entries):
wx.Dialog.__init__(self, parent, title="Help",
style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)
sizer = wx.BoxSizer(wx.VERTICAL)
grid_sizer = wx.FlexGridSizer(0, 3, 8, 6)
# create and add the entries
bold = self.GetFont().MakeBold()
for r, row in enumerate(self.headers + help_entries):
for (col, width) in zip(row, self.widths):
label = wx.StaticText(self, label=col)
if r == 0:
label.SetFont(bold)
label.Wrap(width)
grid_sizer.Add(label, 0, 0, 0)
# finalize layout, create button
sizer.Add(grid_sizer, 0, wx.ALL, 6)
OK = wx.Button(self, wx.ID_OK)
sizer.Add(OK, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 8)
self.SetSizer(sizer)
sizer.Fit(self)
self.Layout()
self.Bind(wx.EVT_CLOSE, self.OnClose)
OK.Bind(wx.EVT_BUTTON, self.OnClose)
示例15: addCheckBoxes
# 需要导入模块: import wx [as 别名]
# 或者: from wx import BoxSizer [as 别名]
def addCheckBoxes(self):
# Regular Box Sizer
boxSizerH = wx.BoxSizer(wx.HORIZONTAL)
chk1 = wx.CheckBox(self.panel, label='Disabled')
chk1.SetValue(True)
chk1.Disable()
boxSizerH.Add(chk1)
chk2 = wx.CheckBox(self.panel, label='UnChecked')
boxSizerH.Add(chk2, flag=wx.LEFT, border=10)
chk3 = wx.CheckBox(self.panel, label='Toggle')
boxSizerH.Add(chk3, flag=wx.LEFT, border=10)
chk3.SetValue(True)
# Add Regular Box Sizer to StaticBox sizer
self.statBoxSizerV.Add(boxSizerH, flag=wx.LEFT, border=10)
self.statBoxSizerV.Add((0, 8))
#----------------------------------------------------------
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:19,代码来源:GUI_wxPython.py