Python wx.Control() Examples

The following are 12 code examples of wx.Control(). 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: wrapped_static_text.py    From Gooey with MIT License 6 votes vote down vote up
def SetLabel(self, label, wrapped=False):
        """
        Sets the :class:`AutoWrapStaticText` label.

        All "&" characters in the label are special and indicate that the following character is
        a mnemonic for this control and can be used to activate it from the keyboard (typically
        by using ``Alt`` key in combination with it). To insert a literal ampersand character, you
        need to double it, i.e. use "&&". If this behaviour is undesirable, use :meth:`~Control.SetLabelText` instead.

        :param string `label`: the new :class:`AutoWrapStaticText` text label;
        :param bool `wrapped`: ``True`` if this method was called by the developer using :meth:`~AutoWrapStaticText.SetLabel`,
         ``False`` if it comes from the :meth:`~AutoWrapStaticText.OnSize` event handler.

        :note: Reimplemented from :class:`wx.Control`.
        """

        if not wrapped:
            self.label = label

        wx.StaticText.SetLabel(self, label) 
Example #3
Source File: Adjustments.py    From meerk40t with MIT License 6 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        device = self.device
        self.Show()
        if device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return
        self.device.execute("Realtime Pause")
        try:
            self.checkbox_pattern_group.SetValue(self.device.interpreter.group_modulation)
        except AttributeError:
            pass 
Example #4
Source File: RotarySettings.py    From meerk40t with MIT License 6 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()
        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return
        self.device.setting(bool, 'rotary', False)
        self.device.setting(float, 'scale_x', 1.0)
        self.device.setting(float, 'scale_y', 1.0)
        self.spin_rotary_scalex.SetValue(self.device.scale_x)
        self.spin_rotary_scaley.SetValue(self.device.scale_y)
        self.checkbox_rotary.SetValue(self.device.rotary)
        self.on_check_rotary(None) 
Example #5
Source File: Controller.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()

        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return

        self.device.setting(int, "buffer_max", 1500)
        self.device.setting(bool, "buffer_limit", True)
        self.device.listen('pipe;status', self.update_status)
        self.device.listen('pipe;packet_text', self.update_packet_text)
        self.device.listen('pipe;buffer', self.on_buffer_update)
        self.device.listen('pipe;usb_state', self.on_connection_state_change)
        self.device.listen('pipe;thread', self.on_control_state)
        self.checkbox_limit_buffer.SetValue(self.device.buffer_limit)
        self.spin_packet_buffer_max.SetValue(self.device.buffer_max)
        self.text_device.SetValue(self.device.device_name)
        self.text_location.SetValue(self.device.device_location) 
Example #6
Source File: BufferView.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()
        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return
        pipe = self.device.interpreter.pipe
        buffer = None
        if pipe is not None:
            try:
                buffer = pipe._buffer + pipe._queue
            except AttributeError:
                buffer = None
        if buffer is None:
            buffer = _("Could not find buffer.\n")

        try:
            bufferstr = buffer.decode()
        except ValueError:
            bufferstr = buffer.decode("ascii")
        except AttributeError:
            bufferstr = buffer

        self.text_buffer_length = self.text_buffer_length.SetValue(str(len(bufferstr)))
        self.text_buffer_info = self.text_buffer_info.SetValue(bufferstr) 
Example #7
Source File: CameraInteface.py    From meerk40t with MIT License 5 votes vote down vote up
def camera_error_requirement(self):
        try:
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _(
                "If using a precompiled binary, this was requirement was not included.\nIf using pure Python, add it with: pip install opencv-python-headless"),
                                   _("Interface Requires OpenCV."), wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
        except RuntimeError:
            pass 
Example #8
Source File: CameraInteface.py    From meerk40t with MIT License 5 votes vote down vote up
def camera_error_webcam(self):
        try:
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("No Webcam found."),
                                   _("Error"), wx.OK | wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
        except RuntimeError:
            pass 
Example #9
Source File: CameraInteface.py    From meerk40t with MIT License 5 votes vote down vote up
def camera_success(self):
        try:
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(True)
        except RuntimeError:
            pass 
Example #10
Source File: JobSpooler.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()
        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return
        self.device.listen('spooler;queue', self.on_spooler_update)
        self.refresh_spooler_list() 
Example #11
Source File: JobInfo.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('module', self.name)
        self.Show()
        self.operations = []
        self.device.setting(bool, "rotary", False)
        self.device.setting(float, "scale_x", 1.0)
        self.device.setting(float, "scale_y", 1.0)
        self.device.setting(bool, "prehome", False)
        self.device.setting(bool, "autohome", False)
        self.device.setting(bool, "autobeep", True)
        self.device.setting(bool, "autostart", True)
        self.device.listen('element_property_update', self.on_element_property_update)

        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()
            return
        self.menu_prehome.Check(self.device.prehome)
        self.menu_autohome.Check(self.device.autohome)
        self.menu_autobeep.Check(self.device.autobeep)
        self.menu_autostart.Check(self.device.autostart) 
Example #12
Source File: Alignment.py    From meerk40t with MIT License 5 votes vote down vote up
def initialize(self):
        self.device.close('window', self.name)
        self.Show()
        if self.device.is_root():
            for attr in dir(self):
                value = getattr(self, attr)
                if isinstance(value, wx.Control):
                    value.Enable(False)
            dlg = wx.MessageDialog(None, _("You do not have a selected device."),
                                   _("No Device Selected."), wx.OK | wx.ICON_WARNING)
            result = dlg.ShowModal()
            dlg.Destroy()