本文整理汇总了Python中wx.EVT_SIZE属性的典型用法代码示例。如果您正苦于以下问题:Python wx.EVT_SIZE属性的具体用法?Python wx.EVT_SIZE怎么用?Python wx.EVT_SIZE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.EVT_SIZE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(self, parent):
wx.Panel.__init__(self, parent, size=(-1, 25), style=wx.SUNKEN_BORDER)
self._value = LEVEL_MIN
self._threshold = LEVEL_MIN
self._noise = None
font = self.GetFont()
font.SetFamily(wx.FONTFAMILY_MODERN)
self.SetFont(font)
self.SetMinSize((250, 25))
self.Bind(wx.EVT_PAINT, self.__on_paint)
self.Bind(wx.EVT_SIZE, self.__on_size)
try:
self.SetBackgroundStyle(wx.BG_STYLE_PAINT)
except AttributeError:
pass
示例2: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(self, layout_type):
wx.Frame.__init__(self, parent=None, id=-1)
self.SetDoubleBuffered(True)
# type of gui to render
self.layout_type = layout_type
# Components
self.icon = None
self.head_panel = None
self.config_panel = None
self.runtime_display = None
self.foot_panel = None
self.panels = None
self._init_properties()
self._init_components()
self._do_layout()
self.Bind(wx.EVT_SIZE, self.onResize)
self.Bind(wx.EVT_CLOSE, self.onClose)
示例3: do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def do_layout(self, parent, title, msg):
self.panel = wx.Panel(parent)
self.widget = wx.CheckBox(self.panel)
# self.widget.SetValue(self.default_value)
self.title = self.format_title(self.panel, title)
self.help_msg = self.format_help_msg(self.panel, msg)
self.help_msg.SetMinSize((0, -1))
# self.help_msg.Bind(wx.EVT_LEFT_UP, lambda event: self.widget.SetValue(not self.widget.GetValue()))
vertical_container = wx.BoxSizer(wx.VERTICAL)
vertical_container.Add(self.title)
horizontal_sizer = wx.BoxSizer(wx.HORIZONTAL)
horizontal_sizer.Add(self.widget, 0, wx.EXPAND | wx.RIGHT, 10)
horizontal_sizer.Add(self.help_msg, 1, wx.EXPAND)
vertical_container.Add(horizontal_sizer, 0, wx.EXPAND)
self.panel.SetSizer(vertical_container)
self.panel.Bind(wx.EVT_SIZE, self.onResize)
return self.panel
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(self, parent, id):
style = wx.WANTS_CHARS | wx.FULL_REPAINT_ON_RESIZE | wx.NO_BORDER
wx.Control.__init__(self, parent, id, style = style)
self.panel = parent
wx.EVT_SIZE(self, self.OnSize)
wx.EVT_PAINT(self, self.OnPaint)
wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
wx.EVT_LEFT_DOWN(self, self.OnLeftDown)
wx.EVT_LEFT_UP(self, self.OnLeftUp)
wx.EVT_LEFT_DCLICK(self, self.OnLeftDown)
wx.EVT_RIGHT_DOWN(self, self.OnRightDown)
wx.EVT_MOTION(self, self.OnMotion)
wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel)
wx.EVT_CHAR(self, self.OnKeyChar)
self.createEmptySp()
self.updateScreen(redraw = False)
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(self, *args, **kwds):
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.GLinitialized = False
attribList = (glcanvas.WX_GL_RGBA, # RGBA
glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered
glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit
# Create the canvas
self.canvas = glcanvas.GLCanvas(self, attribList=attribList)
# Set the event handlers.
self.canvas.Bind(wx.EVT_ERASE_BACKGROUND, self._doEraseBackground)
self.canvas.Bind(wx.EVT_SIZE, self._doSize)
self.canvas.Bind(wx.EVT_PAINT, self._doPaint)
# Canvas Proxy Methods
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(self, parent):
wx.Panel.__init__(self, parent)
imageFile = 'Tile.bmp'
self.bmp = wx.Bitmap(imageFile)
# react to a resize event and redraw image
parent.Bind(wx.EVT_SIZE, self.canvasCallback)
menu = wx.Menu()
menu.Append(wx.ID_ABOUT, "About", "wxPython GUI")
menu.AppendSeparator()
menu.Append(wx.ID_EXIT, "Exit", " Exit the GUI")
menuBar = wx.MenuBar()
menuBar.Append(menu, "File")
parent.SetMenuBar(menuBar)
self.textWidget = wx.TextCtrl(self, size=(280, 80), style=wx.TE_MULTILINE)
button = wx.Button(self, label="Create OpenGL 3D Cube", pos=(60, 100))
self.Bind(wx.EVT_BUTTON, self.buttonCallback, button)
parent.CreateStatusBar()
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:24,代码来源:wxPython_Wallpaper.py
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(self, parent, widgets=None, req_cols=1, opt_cols=3, title=None, **kwargs):
ScrolledPanel.__init__(self, parent, **kwargs)
self.SetupScrolling(scroll_x=False, scrollToTop=False)
self.SetDoubleBuffered(True)
self.title = title
self.widgets = component_builder.build_components(widgets)
self._num_req_cols = req_cols
self._num_opt_cols = opt_cols
self._controller = None
self._do_layout()
self.Bind(wx.EVT_SIZE, self.OnResize)
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(self, build_spec):
wx.Frame.__init__(self, parent=None, id=-1)
self.build_spec = build_spec
self._controller = None
self.SetDoubleBuffered(True)
# Components
self.icon = None
self.head_panel = None
self.config_panel = None
self.runtime_display = None
self.foot_panel = None
self.panels = None
self._init_properties()
self._init_components()
self._do_layout()
self._init_pages()
self._init_controller()
self.registerControllers()
self.Bind(wx.EVT_SIZE, self.onResize)
示例9: do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def do_layout(self, parent):
self.panel = wx.Panel(parent)
self.title = self.createTitle(self.panel)
self.help_msg = self.createHelpMsgWidget(self.panel)
self.help_msg.SetMinSize((0, -1))
core_widget_set = self.widget_pack.build(self.panel, self.data)
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)
# self.panel.Bind(wx.EVT_SIZE, self.onResize)
return self.panel
示例10: do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def do_layout(self, parent):
self.panel = wx.Panel(parent)
self.title = self.createTitle(self.panel)
self.help_msg = self.createHelpMsgWidget(self.panel)
self.help_msg.SetMinSize((0, -1))
core_widget_set = self.widget_pack.build(self.panel, self.data)
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)
self.panel.Bind(wx.EVT_SIZE, self.onResize)
return self.panel
示例11: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(self, parent, widgetInfo, *args, **kwargs):
super(TextContainer, self).__init__(parent, *args, **kwargs)
self.info = widgetInfo
self._id = widgetInfo['id']
self._meta = widgetInfo['data']
self._options = widgetInfo['options']
self.label = wx.StaticText(self, label=widgetInfo['data']['display_name'])
self.help_text = AutoWrappedStaticText(self, label=widgetInfo['data']['help'] or '')
self.error = AutoWrappedStaticText(self, label='')
self.error.Hide()
self.widget = self.getWidget(self)
self.layout = self.arrange(*args, **kwargs)
self.setColors()
self.SetSizer(self.layout)
self.Bind(wx.EVT_SIZE, self.onSize)
# Checking for None instead of truthiness means False-evaluaded defaults can be used.
if self._meta['default'] is not None:
self.setValue(self._meta['default'])
示例12: finish_widget_creation
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def finish_widget_creation(self, level):
self.widget.Bind(wx.EVT_SIZE, self.on_size)
# store the actual values of font as default, if the property is deactivated later
fnt = self.widget.GetFont()
if not fnt.IsOk(): fnt = wx.SystemSettings_GetFont(wx.SYS_DEFAULT_GUI_FONT)
self._original['font'] = fnt
if self.check_prop_truth("font"): self._set_font()
if self.check_prop_truth("wrap"): self.widget.Wrap(self.wrap)
if self.check_prop("size"): self.set_size()
if self.check_prop("background"): self.widget.SetBackgroundColour(self.background)
if self.check_prop("foreground"): self.widget.SetForegroundColour(self.foreground)
EditBase.finish_widget_creation(self, level)
self.widget.Bind(wx.EVT_CHAR_HOOK, self.on_char_hook)
示例13: create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def create(self):
# creates/shows the widget of the given toplevel node and all its children
wx.BeginBusyCursor()
try:
WindowBase.create(self)
finally:
wx.EndBusyCursor()
# from old code:
# below, probably check_prop should be False
## set the best size for the widget (if no one is given)
#if not self.check_prop('size'):
#if self.sizer: # self.sizer is the containing sizer, i.e. the parent
#self.sizer.fit_parent()
#elif self.WX_CLASS=="wxPanel" and self.children:
#wx.Yield() # by now, there are probably many EVT_SIZE in the queue
#self.children[0].fit_parent()
self.widget.GetTopLevelParent().Show()
# SafeYield and SetFocus are required for e.g. Ubuntu w. Python 3.8 and wxPython 4.0.7
# see file SIMPLIFICATIONS\Tests_full.wxg where the first frame will not be layouted
wx.SafeYield()
self.widget.Raise()
self.widget.SetFocus()
示例14: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(self, parent):
wx.Panel.__init__( self, parent, -1, name='PropertyPanel' )
self.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_BTNFACE) )
self.current_widget = None # instance currently being edited
self.next_widget = None # the next one, will only be edited after a small delay
self.pagenames = None
sizer = wx.BoxSizer(wx.VERTICAL)
self.heading = wx.TextCtrl(self, style=wx.TE_READONLY)
sizer.Add(self.heading, 0, wx.EXPAND, 0)
self.notebook = wx.Notebook(self)
self.notebook.Bind(wx.EVT_SIZE, self.on_notebook_size)
sizer.Add(self.notebook, 1, wx.EXPAND, 0)
# for GTK3: add a panel to determine page size
p = wx.Panel(self.notebook)
self.notebook.AddPage(p, "panel")
self._notebook_decoration_size = None
p.Bind(wx.EVT_SIZE, self.on_panel_size)
self.SetSizer(sizer)
self.Layout()
示例15: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import EVT_SIZE [as 别名]
def __init__(
self,
parent = None,
id = -1,
label = "",
pos = (-1, -1),
size = (-1, -1),
style = wx.BORDER_SIMPLE,
name = "Monitors",
background = wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENU)
):
wx.Panel.__init__(self, parent, id, pos, size, style, name)
b1 = 2
b2 = 3
b3 = self.GetWindowBorderSize()[1]
lbl = wx.StaticText(self, -1, eg.text.General.monitorsLabel, pos = ((b2, b1)))
lbl.Enable(False)
monsCtrl = MonsListCtrl(self, ((b2, 2 * b1 + lbl.GetSize()[1])))
self.SetBackgroundColour(wx.Colour(*background))
monsCtrl.SetBackgroundColour(wx.Colour(*background))
w, h = monsCtrl.GetRealSize()
self.size = (w + 2 * b2 + 2, h + lbl.GetSize()[1] + 2 * b1 + b2 + b3)
self.SetMinSize(self.size)
self.Bind(wx.EVT_SIZE, self.OnSize)