Python wx.EVT_SIZE Examples

The following are 30 code examples of wx.EVT_SIZE(). 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: trelby.py    From trelby with GNU General Public License v2.0 7 votes vote down vote up
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) 
Example #2
Source File: edit_windows.py    From wxGlade with MIT License 6 votes vote down vote up
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) 
Example #3
Source File: components.py    From pyFileFixity with MIT License 6 votes vote down vote up
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 
Example #4
Source File: ImagePicker.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent, label, title="", mesg="", imageString=None):
        self.title = title
        self.mesg = mesg
        self.imageString = imageString
        wx.Window.__init__(self, parent, -1)
        self.button = wx.Button(self, -1, label)
        self.imageBox = wx.StaticBitmap(
            self, -1, size=(10, 10), style=wx.SUNKEN_BORDER
        )
        self.SetValue(imageString)
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.button, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
        sizer.Add(self.imageBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
        self.SetSizer(sizer)
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
        self.Layout() 
Example #5
Source File: base_window.py    From pyFileFixity with MIT License 6 votes vote down vote up
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) 
Example #6
Source File: advanced_config.py    From pyFileFixity with MIT License 6 votes vote down vote up
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) 
Example #7
Source File: components.py    From pyFileFixity with MIT License 6 votes vote down vote up
def do_layout(self, parent):
    self.panel = wx.Panel(parent)

    self.widget = wx.CheckBox(self.panel)
    self.title = self.createTitle(self.panel)
    self.help_msg = self.createHelpMsgWidget(self.panel)
    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 
Example #8
Source File: bases.py    From Gooey with MIT License 6 votes vote down vote up
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']) 
Example #9
Source File: ActionSelectButton.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent, label, title, mesg, treeLink=None):
        if treeLink is None:
            treeLink = eg.TreeLink(eg.Utils.GetTopLevelWindow(parent).treeItem)
        self.treeLink = treeLink
        self.action = treeLink.target
        if self.action is None:
            actionName = ""
        else:
            actionName = self.action.GetLabel()
        self.title = title
        self.mesg = mesg
        wx.Window.__init__(self, parent, -1)
        self.textBox = eg.StaticTextBox(self, -1, actionName, size=(200, -1))
        self.button = wx.Button(self, -1, label)
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.textBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
        sizer.Add(self.button, 0, wx.LEFT, 5)
        self.SetSizer(sizer)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
        self.Layout() 
Example #10
Source File: AnimatedWindow.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent):
        wx.PyWindow.__init__(self, parent)
        self.font = wx.Font(
            40, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_BOLD
        )
        self.SetBackgroundColour((255, 255, 255))
        self.logo1 = GetInternalBitmap("opensource-55x48")
        self.logo2 = GetInternalBitmap("python-powered")
        self.logo3 = GetInternalBitmap("logo2")
        self.image = GetInternalImage("logo")
        self.bmpWidth = self.image.GetWidth()
        self.bmpHeight = self.image.GetHeight()
        self.time = clock()
        self.count = 0
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_TIMER, self.UpdateDrawing)
        self.OnSize(None)
        self.timer = wx.Timer(self)
        self.timer.Start(10) 
Example #11
Source File: MonitorsCtrl.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
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) 
Example #12
Source File: wxPython_Wallpaper.py    From Python-GUI-Programming-Cookbook-Second-Edition with MIT License 6 votes vote down vote up
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 #13
Source File: components2.py    From pyFileFixity with MIT License 6 votes vote down vote up
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 
Example #14
Source File: components2.py    From pyFileFixity with MIT License 6 votes vote down vote up
def do_layout(self, parent):
    self.panel = wx.Panel(parent)

    self.widget = wx.CheckBox(self.panel)
    self.title = self.createTitle(self.panel)
    self.help_msg = self.createHelpMsgWidget(self.panel)
    self.help_msg.SetMinSize((0, -1))

    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 
Example #15
Source File: MacroSelectButton.py    From EventGhost with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent, label, title, mesg, treeLink=None):
        if treeLink is None:
            treeLink = eg.TreeLink(eg.Utils.GetTopLevelWindow(parent).treeItem)
        self.treeLink = treeLink
        self.macro = treeLink.target
        if self.macro is None:
            macroName = ""
        else:
            macroName = self.macro.name
        self.title = title
        self.mesg = mesg
        wx.Window.__init__(self, parent, -1)
        self.textBox = eg.StaticTextBox(self, -1, macroName, size=(200, -1))
        self.button = wx.Button(self, -1, label)
        self.Bind(wx.EVT_BUTTON, self.OnButton)
        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.textBox, 1, wx.EXPAND | wx.ALIGN_CENTER_VERTICAL)
        sizer.Add(self.button, 0, wx.LEFT, 5)
        self.SetSizer(sizer)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_SET_FOCUS, self.OnSetFocus)
        self.Layout() 
Example #16
Source File: ConfigEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def _create_ModuleLibraryEditor(self, prnt):
        self.ModuleLibraryEditor = wx.ScrolledWindow(prnt,
                                                     style=wx.TAB_TRAVERSAL | wx.HSCROLL | wx.VSCROLL)
        self.ModuleLibraryEditor.Bind(wx.EVT_SIZE, self.OnResize)

        self.ModuleLibrarySizer = LibraryEditorSizer(
            self.ModuleLibraryEditor,
            self.Controler.GetModulesLibraryInstance(),
            [
                ("ImportButton", "ImportESI", _("Import ESI file"), None),
                ("AddButton", "ImportDatabase", _("Add file from ESI files database"), self.OnAddButton),
                ("DeleteButton", "remove_element", _("Remove file from library"), None)
            ])
        self.ModuleLibrarySizer.SetControlMinSize(wx.Size(0, 200))
        self.ModuleLibraryEditor.SetSizer(self.ModuleLibrarySizer)

        return self.ModuleLibraryEditor 
Example #17
Source File: pycalfem_classes.py    From calfem-python with MIT License 6 votes vote down vote up
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 
Example #18
Source File: classes_wx.py    From calfem-python with MIT License 6 votes vote down vote up
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 
Example #19
Source File: widget_meter.py    From RF-Monitor with GNU General Public License v2.0 6 votes vote down vote up
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 #20
Source File: main.py    From wxGlade with MIT License 6 votes vote down vote up
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() 
Example #21
Source File: DurationCellEditor.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent):
        wx.PyControl.__init__(self, parent)

        main_sizer = wx.FlexGridSizer(cols=2, hgap=0, rows=1, vgap=0)
        main_sizer.AddGrowableCol(0)
        main_sizer.AddGrowableRow(0)

        # create location text control
        self.Duration = wx.TextCtrl(self, size=wx.Size(0, -1),
                                    style=wx.TE_PROCESS_ENTER)
        self.Duration.Bind(wx.EVT_KEY_DOWN, self.OnDurationChar)
        main_sizer.AddWindow(self.Duration, flag=wx.GROW)

        # create browse button
        self.EditButton = wx.Button(self, label='...', size=wx.Size(30, -1))
        self.Bind(wx.EVT_BUTTON, self.OnEditButtonClick, self.EditButton)
        main_sizer.AddWindow(self.EditButton, flag=wx.GROW)

        self.Bind(wx.EVT_SIZE, self.OnSize)

        self.SetSizer(main_sizer)

        self.Default = None 
Example #22
Source File: edit_windows.py    From wxGlade with MIT License 6 votes vote down vote up
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() 
Example #23
Source File: local_display.py    From Pigrow with GNU General Public License v3.0 6 votes vote down vote up
def __init__( self, parent ):
        # Settings
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = "Pigrow Data Display", pos = wx.DefaultPosition, style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        self.Bind(wx.EVT_SIZE, self.resize_window)
        MainApp.display_panel = display_pnl(self)

        # Sizers
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
        main_sizer.Add(MainApp.display_panel, 0, wx.EXPAND)
        MainApp.window_sizer = wx.BoxSizer(wx.VERTICAL)
        MainApp.window_sizer.Add(main_sizer, 0, wx.EXPAND)
        #MainApp.window_sizer.Fit(self)
        self.SetSizer(MainApp.window_sizer)
        MainApp.window_self = self
        self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
        self.Layout()
        self.Centre( wx.BOTH ) 
Example #24
Source File: components.py    From me-ica with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 
Example #25
Source File: base_window.py    From me-ica with GNU Lesser General Public License v2.1 6 votes vote down vote up
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) 
Example #26
Source File: ConfigDialog.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def OnMaximize(self, event):
        if self.buttonRow.sizeGrip:
            self.buttonRow.sizeGrip.Hide()
        self.Bind(wx.EVT_SIZE, self.OnRestore)
        event.Skip() 
Example #27
Source File: StatusBar.py    From EventGhost with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, parent):
        wx.StatusBar.__init__(self, parent, -1)
        self.sizeChanged = False
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_IDLE, self.OnIdle)
        self.SetFieldsCount(2)
        self.SetStatusWidths([-1, 40])
        self.icons = [
            GetInternalBitmap("Tray1"),
            GetInternalBitmap("Tray3"),
            GetInternalBitmap("Tray2"),
        ]
        self.icon = wx.StaticBitmap(self, -1, self.icons[0], (0, 0), (16, 16))
        rect = self.GetFieldRect(0)

        checkBox = wx.CheckBox(self, -1, eg.text.MainFrame.onlyLogAssigned)
        self.checkBox = checkBox
        colour = wx.SystemSettings_GetColour(wx.SYS_COLOUR_MENUBAR)
        checkBox.SetBackgroundColour(colour)
        self.checkBoxColour = checkBox.GetForegroundColour()
        checkBox.SetValue(eg.config.onlyLogAssigned)
        self.SetCheckBoxColour(eg.config.onlyLogAssigned)
        checkBox.Bind(wx.EVT_CHECKBOX, self.OnCheckBox)
        checkBox.SetPosition((rect.x + 2, rect.y + 2))
        checkBox.SetToolTipString(eg.text.MainFrame.onlyLogAssignedToolTip)

        eg.Bind("ProcessingChange", self.OnProcessingChange)
        self.Reposition() 
Example #28
Source File: wx_app.py    From pyopenvr with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def init_gl(self):
		print('creating Frame')
		self.window = wx.Frame ( parent=None, id=wx.ID_ANY, title=self.title,
			style=wx.DEFAULT_FRAME_STYLE|wx.WS_EX_PROCESS_IDLE )
		print('creating GLCanvas')
		self.canvas = glcanvas.GLCanvas ( self.window, glcanvas.WX_GL_RGBA )
		print('creating GLContext')
		self.context = glcanvas.GLContext(self.canvas)
		self.canvas.SetFocus()
		self.window.SetSize ( (self.renderer.window_size[0], self.renderer.window_size[1]) )
		print('showing Frame')
		self.window.Show(True)
		
		print('calling SetTopWindow')
		self.SetTopWindow(self.window)
		
		self.Bind ( wx.EVT_CHAR, self.OnChar )
		self.canvas.Bind ( wx.EVT_SIZE, self.OnCanvasSize )
		self.canvas.Bind ( wx.EVT_PAINT, self.OnCanvasPaint )
		
		wx.IdleEvent.SetMode ( wx.IDLE_PROCESS_SPECIFIED )
		self.Bind ( wx.EVT_IDLE, self.OnIdle )
		
		print('making context current')
		self.canvas.SetCurrent ( self.context )
		self.renderer.init_gl() 
Example #29
Source File: plot_window.py    From topoflow with MIT License 5 votes vote down vote up
def __init__(self, parent, title, labels):
        wx.Window.__init__(self, parent)
        self.title  = title
        self.labels = labels
        self.data   = [0.0] * len(labels)

        self.Init_Buffer()

        self.Bind(wx.EVT_SIZE,  self.On_Resize)
        self.Bind(wx.EVT_PAINT, self.On_Paint)

    #   __init__()
    #------------------------------------------------------------ 
Example #30
Source File: Notebook_Test.py    From topoflow with MIT License 5 votes vote down vote up
def makeColorPanel(self, color):
        p = wx.Panel(self, -1)
        win = ColorPanel.ColoredPanel(p, color)
        p.win = win
        def OnCPSize(evt, win=win):
            win.SetPosition((0,0))
            win.SetSize(evt.GetSize())
        p.Bind(wx.EVT_SIZE, OnCPSize)
        return p