本文整理汇总了Python中wx.Panel方法的典型用法代码示例。如果您正苦于以下问题:Python wx.Panel方法的具体用法?Python wx.Panel怎么用?Python wx.Panel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wx
的用法示例。
在下文中一共展示了wx.Panel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [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 Panel [as 别名]
def __init__(self, parent, **kwargs):
wx.Panel.__init__(self, parent, **kwargs)
self.SetMinSize((30, 53))
# components
self.cancel_button = None
self.start_button = None
self.progress_bar = None
self.close_button = None
self.stop_button = None
self.restart_button = None
self.buttons = None
self.layouts = {}
self._init_components()
self._do_layout()
for button in self.buttons:
self.Bind(wx.EVT_BUTTON, self.dispatch_click, button)
示例3: do_layout
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [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
示例4: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [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
示例5: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [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.''')
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [as 别名]
def __init__(self, parent, id, title):
super().__init__(parent, id, title=title)
main_sizer = self.main_sizer = wx.BoxSizer(wx.VERTICAL)
self.client_or_server = wx.RadioBox(self, wx.ID_ANY, choices=(_("Client"), _("Server")), style=wx.RA_VERTICAL)
self.client_or_server.Bind(wx.EVT_RADIOBOX, self.on_client_or_server)
self.client_or_server.SetSelection(0)
main_sizer.Add(self.client_or_server)
choices = [_("Control another machine"), _("Allow this machine to be controlled")]
self.connection_type = wx.RadioBox(self, wx.ID_ANY, choices=choices, style=wx.RA_VERTICAL)
self.connection_type.SetSelection(0)
main_sizer.Add(self.connection_type)
self.container = wx.Panel(parent=self)
self.panel = ClientPanel(parent=self.container)
main_sizer.Add(self.container)
buttons = self.CreateButtonSizer(wx.OK | wx.CANCEL)
main_sizer.Add(buttons, flag=wx.BOTTOM)
main_sizer.Fit(self)
self.SetSizer(main_sizer)
self.Center(wx.BOTH | WX_CENTER)
ok = wx.FindWindowById(wx.ID_OK, self)
ok.Bind(wx.EVT_BUTTON, self.on_ok)
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [as 别名]
def __init__(self,
parent,
labels,
colors=None,
):
wx.Panel.__init__(self, parent)
self.parent = parent
self.labels = labels
self.n_items = len(self.labels)
if colors is None:
self.colors = self.create_colors(self.n_items)
else:
self.colors = colors
self.create_color_dict()
self._init_ui()
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [as 别名]
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1)
box = wx.BoxSizer(wx.VERTICAL)
box.Add((20, 30))
keys = buttonDefs.keys()
for k in keys:
text = buttonDefs[k][1]
btn = wx.Button(self, k, text)
box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 15)
self.Bind(wx.EVT_BUTTON, self.OnButton, btn)
# put a GLCanvas on the wx.Panel
c = CubeCanvas(self)
c.SetMinSize((200, 200))
box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15)
c = ConeCanvas(self)
c.SetMinSize((200, 200))
box.Add(c, 0, wx.ALIGN_CENTER|wx.ALL, 15)
self.SetAutoLayout(True)
self.SetSizer(box)
开发者ID:PacktPublishing,项目名称:Python-GUI-Programming-Cookbook-Second-Edition,代码行数:27,代码来源:import_OpenGL_cube_and_cone.py
示例9: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [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
示例10: on_option_tab_create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [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)
示例11: on_option_tab_create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [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.
示例12: on_option_tab_create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [as 别名]
def on_option_tab_create(self, notebook):
self.panel = wx.Panel(notebook, wx.ID_ANY)
self.panel_name = _('CSV')
self.layout = wx.BoxSizer(wx.VERTICAL)
self.panel.SetSizer(self.layout)
self.checkEnable = wx.CheckBox(
self.panel, wx.ID_ANY, _('Enable CSV Log'))
self.editCsvFilename = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge')
self.layout.Add(wx.StaticText(self.panel, wx.ID_ANY, _('Log Filename')))
self.layout.Add(self.editCsvFilename, flag=wx.EXPAND)
self.layout.Add(self.checkEnable)
##
# Write a line to text file.
# @param self The Object Pointer.
# @param record Record (text)
#
示例13: on_option_tab_create
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [as 别名]
def on_option_tab_create(self, notebook):
self.panel = wx.Panel(notebook, wx.ID_ANY)
self.panel_name = _('Screenshot')
self.layout = wx.BoxSizer(wx.VERTICAL)
self.panel.SetSizer(self.layout)
self.checkResultDetailEnable = wx.CheckBox(
self.panel, wx.ID_ANY, _('Save screenshots of game results'))
self.editDir = wx.TextCtrl(self.panel, wx.ID_ANY, u'hoge')
self.layout.Add(wx.StaticText(
self.panel, wx.ID_ANY, _('Folder to save screenshots')))
self.layout.Add(self.editDir, flag=wx.EXPAND)
self.layout.Add(self.checkResultDetailEnable)
self.panel.SetSizer(self.layout)
##
# on_result_detail_still Hook
# @param self The Object Pointer
# @param context IkaLog context
#
示例14: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [as 别名]
def __init__(self, *args, **kwargs):
wx.Panel.__init__(self, *args, **kwargs)
# This is used to determine if a file dialog is open or not.
self.prev_file_path = ''
# Textbox for input file
self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, '')
self.text_ctrl.Bind(wx.EVT_TEXT, self.on_text_input)
self.button = wx.Button(self, wx.ID_ANY, _('Browse'))
self.button.Bind(wx.EVT_BUTTON, self.on_button_click)
# Drag and drop
drop_target = FileDropTarget(self)
self.text_ctrl.SetDropTarget(drop_target)
top_sizer = wx.BoxSizer(wx.HORIZONTAL)
top_sizer.Add(self.text_ctrl, proportion=1)
top_sizer.Add(self.button)
self.SetSizer(top_sizer)
示例15: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import Panel [as 别名]
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
panel = wx.Panel(self)
# create the GUI elements
self.createCanvas(panel)
self.createSliders(panel)
# place them in a sizer for the Layout
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.canvas, 1, wx.EXPAND)
sizer.Add(self.frequencySliderGroup.sizer, 0,
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)
sizer.Add(self.amplitudeSliderGroup.sizer, 0,
wx.EXPAND | wx.ALIGN_CENTER | wx.ALL, border=5)
panel.SetSizer(sizer)