Python wx.Panel() Examples
The following are 30
code examples of wx.Panel().
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: widget_meter.py From RF-Monitor with GNU General Public License v2.0 | 6 votes |
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
Example #2
Source File: daily.py From Bruno with MIT License | 6 votes |
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.''')
Example #3
Source File: dialogs.py From NVDARemote with GNU General Public License v2.0 | 6 votes |
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)
Example #4
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 #5
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 #6
Source File: csv.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 = _('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) #
Example #7
Source File: wxPython_Wallpaper.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 6 votes |
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()
Example #8
Source File: import_OpenGL_cube_and_cone.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 6 votes |
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)
Example #9
Source File: trelby.py From trelby with GNU General Public License v2.0 | 6 votes |
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
Example #10
Source File: screenshot.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 = _('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 #
Example #11
Source File: preview.py From IkaLog with Apache License 2.0 | 6 votes |
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)
Example #12
Source File: fourier_demo_wx_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #13
Source File: embedding_in_wx3_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 6 votes |
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) self.fig = Figure((5, 4), 75) self.canvas = FigureCanvas(self, -1, self.fig) self.toolbar = NavigationToolbar(self.canvas) # matplotlib toolbar self.toolbar.Realize() # self.toolbar.set_active([0,1]) # Now put all into a sizer sizer = wx.BoxSizer(wx.VERTICAL) # This way of adding to sizer allows resizing sizer.Add(self.canvas, 1, wx.LEFT | wx.TOP | wx.GROW) # Best to allow the toolbar to resize! sizer.Add(self.toolbar, 0, wx.GROW) self.SetSizer(sizer) self.Fit()
Example #14
Source File: components.py From me-ica with GNU Lesser General Public License v2.1 | 6 votes |
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
Example #15
Source File: footer.py From me-ica with GNU Lesser General Public License v2.1 | 6 votes |
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)
Example #16
Source File: guiminer.py From poclbm with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent, n_max_lines): wx.Panel.__init__(self, parent, -1) self.parent = parent self.n_max_lines = n_max_lines vbox = wx.BoxSizer(wx.VERTICAL) style = wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL self.text = wx.TextCtrl(self, -1, "", style=style) vbox.Add(self.text, 1, wx.EXPAND) self.SetSizer(vbox) self.handler = logging.StreamHandler(self) formatter = logging.Formatter("%(asctime)s: %(message)s", "%Y-%m-%d %H:%M:%S") self.handler.setFormatter(formatter) logger.addHandler(self.handler)
Example #17
Source File: wm_legend.py From wafer_map with GNU General Public License v3.0 | 6 votes |
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()
Example #18
Source File: wxPython_Wallpaper_simple.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 5 votes |
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) button = wx.Button(self, label="Quit") self.Bind(wx.EVT_BUTTON, self.buttonCallback, button) parent.CreateStatusBar()
Example #19
Source File: GoSyncController.py From gosync with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent, sync_model): wx.Panel.__init__(self, parent, size=parent.GetSize(), style=wx.RAISED_BORDER) self.sync_model = sync_model self.totalFiles = 0 self.time_left=0 aboutdrive = sync_model.DriveInfo() self.driveUsageBar = DriveUsageBox(self, long(aboutdrive['storageQuota']['limit']), -1) self.driveUsageBar.SetStatusMessage("Calculating your categorical Google Drive usage. Please wait.") self.driveUsageBar.SetMoviesUsage(0) self.driveUsageBar.SetDocumentUsage(0) self.driveUsageBar.SetOthersUsage(0) self.driveUsageBar.SetAudioUsage(0) self.driveUsageBar.SetPhotoUsage(0) self.driveUsageBar.RePaint() mainsizer = wx.BoxSizer(wx.VERTICAL) mainsizer.AddSpacer(10) self.SetSizerAndFit(mainsizer) GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_STARTED, self.OnUsageCalculationStarted) GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_DONE, self.OnUsageCalculationDone) GoSyncEventController().BindEvent(self, GOSYNC_EVENT_CALCULATE_USAGE_UPDATE, self.OnUsageCalculationUpdate)
Example #20
Source File: embedding_in_wx5_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, parent, id=-1): wx.Panel.__init__(self, parent, id=id) self.nb = aui.AuiNotebook(self) sizer = wx.BoxSizer() sizer.Add(self.nb, 1, wx.EXPAND) self.SetSizer(sizer)
Example #21
Source File: embedding_in_wx5_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def __init__(self, parent, id=-1, dpi=None, **kwargs): wx.Panel.__init__(self, parent, id=id, **kwargs) self.figure = mpl.figure.Figure(dpi=dpi, figsize=(2, 2)) self.canvas = FigureCanvas(self, -1, self.figure) self.toolbar = NavigationToolbar(self.canvas) self.toolbar.Realize() sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.canvas, 1, wx.EXPAND) sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) self.SetSizer(sizer)
Example #22
Source File: mathtext_wx_sgskip.py From python3_ios with BSD 3-Clause "New" or "Revised" License | 5 votes |
def add_buttonbar(self): self.button_bar = wx.Panel(self) self.button_bar_sizer = wx.BoxSizer(wx.HORIZONTAL) self.sizer.Add(self.button_bar, 0, wx.LEFT | wx.TOP | wx.GROW) for i, (mt, func) in enumerate(functions): bm = mathtext_to_wxbitmap(mt) button = wx.BitmapButton(self.button_bar, 1000 + i, bm) self.button_bar_sizer.Add(button, 1, wx.GROW) self.Bind(wx.EVT_BUTTON, self.OnChangePlot, button) self.button_bar.SetSizer(self.button_bar_sizer)
Example #23
Source File: wm_core.py From wafer_map with GNU General Public License v3.0 | 5 votes |
def _bind_events(self): """ Bind panel and canvas events. Note that key-down is bound again - this allws hotkeys to work even if the main Frame, which defines hotkeys in menus, is not present. wx sents the EVT_KEY_DOWN up the chain and, if the Frame and hotkeys are present, executes those instead. At least I think that's how that works... See http://wxpython.org/Phoenix/docs/html/events_overview.html for more info. """ # Canvas Events self.canvas.Bind(FloatCanvas.EVT_MOTION, self.on_mouse_move) self.canvas.Bind(FloatCanvas.EVT_MOUSEWHEEL, self.on_mouse_wheel) self.canvas.Bind(FloatCanvas.EVT_MIDDLE_DOWN, self.on_mouse_middle_down) self.canvas.Bind(FloatCanvas.EVT_MIDDLE_UP, self.on_mouse_middle_up) self.canvas.Bind(wx.EVT_PAINT, self._on_first_paint) # XXX: Binding the EVT_LEFT_DOWN seems to cause Issue #24. # What seems to happen is: If I bind EVT_LEFT_DOWN, then the # parent panel or application can't set focus to this # panel, which prevents the EVT_MOUSEWHEEL event from firing # properly. # self.canvas.Bind(wx.EVT_LEFT_DOWN, self.on_mouse_left_down) # self.canvas.Bind(wx.EVT_RIGHT_DOWN, self.on_mouse_right_down) # self.canvas.Bind(wx.EVT_LEFT_UP, self.on_mouse_left_up) # self.canvas.Bind(wx.EVT_KEY_DOWN, self._on_key_down) # This is supposed to fix flicker on mouse move, but it doesn't work. # self.Bind(wx.EVT_ERASE_BACKGROUND, None) # Panel Events self.Bind(csel.EVT_COLOURSELECT, self.on_color_change)
Example #24
Source File: chapter2.py From OpenCV-Computer-Vision-Projects-with-Python with MIT License | 5 votes |
def CreateLayout(self): self.pnl = wx.Panel(self, -1, size=(self.imgWidth,self.imgHeight)) self.pnl.SetBackgroundColour(wx.BLACK) self.SetMinSize((self.imgWidth, self.imgHeight)) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.pnl, 1, flag=wx.EXPAND) self.SetSizer(sizer) self.Centre()
Example #25
Source File: APDUTracerPanel.py From pyscard with GNU Lesser General Public License v2.1 | 5 votes |
def __init__(self, parent): wx.Panel.__init__(self, parent, -1) boxsizer = wx.BoxSizer(wx.HORIZONTAL) self.apdutextctrl = wx.TextCtrl( self, wxID_APDUTEXTCTRL, "", pos=wx.DefaultPosition, style=wx.TE_MULTILINE | wx.TE_READONLY) boxsizer.Add(self.apdutextctrl, 1, wx.EXPAND | wx.ALL, 5) self.SetSizer(boxsizer) self.SetAutoLayout(True) self.Bind(wx.EVT_TEXT_MAXLEN, self.OnMaxLength, self.apdutextctrl)
Example #26
Source File: GUI_wxPython.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 5 votes |
def __init__(self, parent): wx.Panel.__init__(self, parent) self.panel = wx.Panel(self) self.createWidgetsFrame() self.createManageFilesFrame() self.addWidgets() self.addFileWidgets() self.layoutWidgets() #----------------------------------------------------------
Example #27
Source File: backend_wx.py From Computable with MIT License | 5 votes |
def Destroy(self, *args, **kwargs): wx.Panel.Destroy(self, *args, **kwargs)
Example #28
Source File: backend_wx.py From matplotlib-4-abaqus with MIT License | 5 votes |
def Destroy(self, *args, **kwargs): wx.Panel.Destroy(self, *args, **kwargs)
Example #29
Source File: Communicate.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 5 votes |
def __init__(self, parent): wx.Panel.__init__(self, parent) parent.CreateStatusBar() menu= wx.Menu() menu.Append(wx.ID_ABOUT, "About", "wxPython GUI") menuBar = wx.MenuBar() menuBar.Append(menu, "File") parent.SetMenuBar(menuBar) button = wx.Button(self, label="Print", pos=(0,60)) self.Bind(wx.EVT_BUTTON, self.writeToSharedQueue, button) self.textBox = wx.TextCtrl(self, size=(280,50), style=wx.TE_MULTILINE) #-----------------------------------------------------------------
Example #30
Source File: GUI_wxPython.py From Python-GUI-Programming-Cookbook-Second-Edition with MIT License | 5 votes |
def createNotebook(self): panel = wx.Panel(self) notebook = wx.Notebook(panel) widgets = Widgets(notebook) notebook.AddPage(widgets, "Widgets") notebook.SetBackgroundColour(BACKGROUNDCOLOR) # layout boxSizer = wx.BoxSizer() boxSizer.Add(notebook, 1, wx.EXPAND) panel.SetSizerAndFit(boxSizer) #====================== # Start GUI #======================