Python wx.ID_ANY Examples

The following are 30 code examples of wx.ID_ANY(). 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: sct_plugin.py    From spinalcordtoolbox with MIT License 6 votes vote down vote up
def __init__(self, parent):
        # TODO: try to use MessageBox instead, as they already include buttons, icons, etc.
        wx.Dialog.__init__(self, parent, title="SCT Processing")
        self.SetSize((300, 120))

        vbox = wx.BoxSizer(wx.VERTICAL)
        lbldesc = wx.StaticText(self, id=wx.ID_ANY, label="Processing, please wait...")
        vbox.Add(lbldesc, 0, wx.ALIGN_LEFT | wx.ALL, 10)

        btns = self.CreateSeparatedButtonSizer(wx.CANCEL)
        vbox.Add(btns, 0, wx.ALIGN_LEFT | wx.ALL, 5)

        hbox = wx.BoxSizer(wx.HORIZONTAL)

        # TODO: use a nicer image, showing two gears (similar to ID_EXECUTE)
        save_ico = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR, (50, 50))
        img_info = wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth(), save_ico.GetHeight()))

        hbox.Add(img_info, 0, wx.ALL, 10)
        hbox.Add(vbox, 0, wx.ALL, 0)

        self.SetSizer(hbox)
        self.Centre()
        self.CenterOnParent()
        # TODO: retrieve action from the cancel button 
Example #2
Source File: backend_wx.py    From Mastering-Elasticsearch-7.0 with MIT License 6 votes vote down vote up
def __init__(self, parent):

        wx.Button.__init__(self, parent, wx.ID_ANY, "Axes:        ",
                           style=wx.BU_EXACTFIT)
        self._toolbar = parent
        self._menu = wx.Menu()
        self._axisId = []
        # First two menu items never change...
        self._allId = wx.NewId()
        self._invertId = wx.NewId()
        self._menu.Append(self._allId, "All", "Select all axes", False)
        self._menu.Append(self._invertId, "Invert", "Invert axes selected",
                          False)
        self._menu.AppendSeparator()

        self.Bind(wx.EVT_BUTTON, self._onMenuButton, id=self.GetId())
        self.Bind(wx.EVT_MENU, self._handleSelectAllAxes, id=self._allId)
        self.Bind(wx.EVT_MENU, self._handleInvertAxesSelected,
                  id=self._invertId) 
Example #3
Source File: elecsus_gui.py    From ElecSus with Apache License 2.0 6 votes vote down vote up
def _init_default_values(self):
		""" Initialise default values for various things ... """
		
		self.figs = []
		self.canvases = []
		self.fig_IDs = []
		
		self.hold = False
		
		self.fit_algorithm = 'Marquardt-Levenberg'
		self.already_fitting = False
		self.warnings = True

		# initialise advanced fit options dictionary
		dlg = AdvancedFitOptions(self,"Advanced Fit Options",wx.ID_ANY)
		self.advanced_fitoptions = dlg.return_all_options()
		dlg.Destroy() 
Example #4
Source File: websocket_server.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
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: chronolapsegui.py    From chronolapse with MIT License 6 votes vote down vote up
def __init__(self, *args, **kwds):
        # begin wxGlade: webcamConfigDialog.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.testwebcambutton = wx.Button(self, wx.ID_ANY, _("Test Webcam"))
        self.webcamtimestampcheck = wx.CheckBox(self, wx.ID_ANY, _("Show Timestamp"))
        self.label_16 = wx.StaticText(self, wx.ID_ANY, _("Format:"))
        self.webcam_timestamp_format = wx.TextCtrl(self, wx.ID_ANY, _("%Y-%m-%d %H:%M:%S"))
        self.label_9 = wx.StaticText(self, wx.ID_ANY, _("File Prefix:"))
        self.webcamprefixtext = wx.TextCtrl(self, wx.ID_ANY, _("cam_"))
        self.label_10 = wx.StaticText(self, wx.ID_ANY, _("Save Folder:"))
        self.webcamsavefoldertext = wx.TextCtrl(self, wx.ID_ANY, "")
        self.webcamsavefolderbrowse = wx.Button(self, wx.ID_ANY, _("..."))
        self.label_11 = wx.StaticText(self, wx.ID_ANY, _("File Format:"))
        self.webcamformatcombo = wx.ComboBox(self, wx.ID_ANY, choices=[_("jpg"), _("png"), _("gif")], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN)
        self.webcamsavebutton = wx.Button(self, wx.ID_OK, "")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_BUTTON, self.testWebcamPressed, self.testwebcambutton)
        self.Bind(wx.EVT_BUTTON, self.webcamSaveFolderBrowse, self.webcamsavefolderbrowse)
        # end wxGlade 
Example #6
Source File: systray.py    From p2ptv-pi with MIT License 6 votes vote down vote up
def CreatePopupMenu(self):
        menu = wx.Menu()
        mi = menu.Append(wx.ID_ANY, self.bgapp.utility.lang.get('options_etc'))
        self.Bind(wx.EVT_MENU, self.OnOptions, id=mi.GetId())
        menu.AppendSeparator()
        if self.bgapp.user_profile is not None:
            mi = menu.Append(wx.ID_ANY, self.bgapp.utility.lang.get('user_profile'))
            self.Bind(wx.EVT_MENU, self.OnUserProfile, id=mi.GetId())
            menu.AppendSeparator()
        mi = menu.Append(wx.ID_ANY, self.bgapp.utility.lang.get('create_stream'))
        self.Bind(wx.EVT_MENU, self.OnStream, id=mi.GetId())
        menu.AppendSeparator()
        if DEBUG:
            mi = menu.Append(wx.ID_ANY, 'Statistics')
            self.Bind(wx.EVT_MENU, self.OnStat, id=mi.GetId())
            menu.AppendSeparator()
        if DEBUG_LIVE:
            mi = menu.Append(wx.ID_ANY, 'Live')
            self.Bind(wx.EVT_MENU, self.OnLive, id=mi.GetId())
            menu.AppendSeparator()
        mi = menu.Append(wx.ID_ANY, self.bgapp.utility.lang.get('menuexit'))
        self.Bind(wx.EVT_MENU, self.OnExitClient, id=mi.GetId())
        return menu 
Example #7
Source File: hue.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
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 #8
Source File: dialogs.py    From NVDARemote with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent=None, id=wx.ID_ANY):
		super().__init__(parent, id)
		sizer = wx.BoxSizer(wx.HORIZONTAL)
		# Translators: Used in server mode to obtain the external IP address for the server (controlled computer) for direct connection.
		self.get_IP = wx.Button(parent=self, label=_("Get External &IP"))
		self.get_IP.Bind(wx.EVT_BUTTON, self.on_get_IP)
		sizer.Add(self.get_IP)
		# Translators: Label of the field displaying the external IP address if using direct (client to server) connection.
		sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&External IP:")))
		self.external_IP = wx.TextCtrl(self, wx.ID_ANY, style=wx.TE_READONLY|wx.TE_MULTILINE)
		sizer.Add(self.external_IP)
		# Translators: The label of an edit field in connect dialog to enter the port the server will listen on.
		sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Port:")))
		self.port = wx.TextCtrl(self, wx.ID_ANY, value=str(socket_utils.SERVER_PORT))
		sizer.Add(self.port)
		sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Key:")))
		self.key = wx.TextCtrl(self, wx.ID_ANY)
		sizer.Add(self.key)
		self.generate_key = wx.Button(parent=self, label=_("&Generate Key"))
		self.generate_key.Bind(wx.EVT_BUTTON, self.on_generate_key)
		sizer.Add(self.generate_key)
		self.SetSizerAndFit(sizer) 
Example #9
Source File: dialogs.py    From NVDARemote with GNU General Public License v2.0 6 votes vote down vote up
def __init__(self, parent=None, id=wx.ID_ANY):
		super().__init__(parent, id)
		sizer = wx.BoxSizer(wx.HORIZONTAL)
		# Translators: The label of an edit field in connect dialog to enter name or address of the remote computer.
		sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Host:")))
		self.host = wx.TextCtrl(self, wx.ID_ANY)
		sizer.Add(self.host)
		# Translators: Label of the edit field to enter key (password) to secure the remote connection.
		sizer.Add(wx.StaticText(self, wx.ID_ANY, label=_("&Key:")))
		self.key = wx.TextCtrl(self, wx.ID_ANY)
		sizer.Add(self.key)
		# Translators: The button used to generate a random key/password.
		self.generate_key = wx.Button(parent=self, label=_("&Generate Key"))
		self.generate_key.Bind(wx.EVT_BUTTON, self.on_generate_key)
		sizer.Add(self.generate_key)
		self.SetSizerAndFit(sizer) 
Example #10
Source File: csv.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
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 #11
Source File: gui.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
def __init__(self, engine, outputs):
        self.engine = engine
        self.capture = engine.capture
        self.outputs = outputs
        self.frame = wx.Frame(None, wx.ID_ANY, "IkaLog GUI", size=(700, 500))
        self.options_gui = OptionsGUI(self)
        self.last_result = ResultsGUI(self)

        self.layout = wx.BoxSizer(wx.VERTICAL)

        self.create_buttons_ui()
        self.layout.Add(self.buttons_layout)

        self.preview = PreviewPanel(self.frame, size=(640, 420))
        self.preview.Bind(EVT_INPUT_FILE_ADDED, self.on_input_file_added)
        self.preview.Bind(EVT_IKALOG_PAUSE, self.on_ikalog_pause)

        self.layout.Add(self.preview, flag=wx.EXPAND)
        self.frame.SetSizer(self.layout)

        # Frame events
        self.frame.Bind(wx.EVT_CLOSE, self.on_close)

        # Video files processed and to be processed.
        self._file_list = [] 
Example #12
Source File: screenshot.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
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 #13
Source File: preview.py    From IkaLog with Apache License 2.0 6 votes vote down vote up
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 #14
Source File: testingManualEntryPanel.py    From HH---POS-Accounting-and-ERP-Software with MIT License 6 votes vote down vote up
def __init__(self, parent):

        wx.Dialog.__init__(self, parent, wx.ID_ANY, "Manual Entry", size=(650, 600))
        self.panel = wx.Panel(self, wx.ID_ANY)

        self.mainSizer = wx.BoxSizer(wx.VERTICAL)

        self.folios = self.fetchFolios()

        self.lblFolioD = wx.StaticText(self.panel, label="Folio (Debit)")
        self.folioComboD = wx.ComboBox(self.panel, choices=list(self.folios.keys()))

        self.mainSizer.Add(self.lblFolioD)
        self.mainSizer.Add(self.folioComboD)

        self.SetSizer(self.mainSizer)
        self.Layout()
        self.mainSizer.Fit(self.panel)
        self.Centre(wx.BOTH)

        self.Bind(wx.EVT_CLOSE, self.OnQuit)

        self.Show() 
Example #15
Source File: sct_plugin.py    From spinalcordtoolbox with MIT License 5 votes vote down vote up
def __init__(self, parent, id_):
        super(SCTPanel, self).__init__(parent=parent, id=id_)

        # Logo
        self.img_logo = self.get_logo()
        self.sizer_logo_sct = wx.BoxSizer(wx.VERTICAL)
        self.sizer_logo_sct.Add(self.img_logo, 0, wx.ALL, 5)

        # Citation
        txt_sct_citation = wx.VSCROLL | \
                           wx.HSCROLL | wx.TE_READONLY | \
                           wx.BORDER_SIMPLE
        html_sct_citation = html.HtmlWindow(self, wx.ID_ANY,
                                            size=(280, 115),
                                            style=txt_sct_citation)
        html_sct_citation.SetPage(self.DESCRIPTION_SCT)
        self.sizer_logo_sct.Add(html_sct_citation, 0, wx.ALL, 5)

        # Help button
        button_help = wx.Button(self, id=id_, label="Help")
        button_help.Bind(wx.EVT_BUTTON, self.tutorial)
        self.sizer_logo_sct.Add(button_help, 0, wx.ALL, 5)

        # Get function-specific description
        self.html_desc = self.get_description()

        # Organize boxes
        self.sizer_logo_text = wx.BoxSizer(wx.HORIZONTAL)  # create main box
        self.sizer_logo_text.Add(self.sizer_logo_sct, 0, wx.ALL, 5)
        # TODO: increase the width of the description box
        self.sizer_logo_text.Add(self.html_desc, 0, wx.ALL, 5)

        self.sizer_h = wx.BoxSizer(wx.HORIZONTAL)
        self.sizer_h.Add(self.sizer_logo_text) 
Example #16
Source File: newProd.py    From HH---POS-Accounting-and-ERP-Software with MIT License 5 votes vote down vote up
def __init__(self, parent, bc):
        wx.Dialog.__init__(self, parent, wx.ID_ANY, "New Product", size= (650,360))
        self.panel = wx.Panel(self,wx.ID_ANY)

        self.lblName = wx.StaticText(self.panel, label="Name", pos=(20,20))
        self.name = wx.TextCtrl(self.panel, value="", pos=(110,20), size=(500,-1))
        
        self.lblBarcode = wx.StaticText(self.panel, label="Barcode", pos=(20,60))
        self.barcode = wx.TextCtrl(self.panel, value="", pos=(110,60), size=(500,-1))
        self.barcode.SetValue(str(bc))
        
        self.lblCP = wx.StaticText(self.panel, label="Cost Price", pos=(20,100))
        self.costPrice = wx.TextCtrl(self.panel, value="", pos=(110,100), size=(500,-1), validator=numOnlyValidator())
        
        self.lblSP = wx.StaticText(self.panel, label="Selling Price", pos=(20,140))
        self.sellingPrice = wx.TextCtrl(self.panel, value="", pos=(110,140), size=(500,-1), validator=numOnlyValidator())
        
        self.lblQty = wx.StaticText(self.panel, label="Quantity", pos=(20,180))
        self.qty = wx.TextCtrl(self.panel, value="", pos=(110,180), size=(500,-1), validator=numOnlyValidator())
        
        self.lblmlvl = wx.StaticText(self.panel, label="Minimum Level", pos=(20,220))
        self.minLvl = wx.TextCtrl(self.panel, value="", pos=(110,220), size=(500,-1), validator=numOnlyValidator())
        
        self.lblcdn = wx.StaticText(self.panel, label="Codename", pos=(20,260))
        self.cdn = wx.TextCtrl(self.panel, value="", pos=(110,260), size=(500,-1))
        
        self.saveButton =wx.Button(self.panel, label="Save", pos=(110,300))
        self.closeButton =wx.Button(self.panel, label="Cancel", pos=(250,300))
        
        self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
        self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
        
        self.Bind(wx.EVT_CLOSE, self.OnQuit)
        
        self.Show() 
Example #17
Source File: newCust.py    From HH---POS-Accounting-and-ERP-Software with MIT License 5 votes vote down vote up
def __init__(self, parent, terminalObj):
        self.t = terminalObj
    	
        wx.Dialog.__init__(self, parent, wx.ID_ANY, "Name Input", size= (650,300))
        self.panel = wx.Panel(self,wx.ID_ANY)

        self.lblName = wx.StaticText(self.panel, label="Name", pos=(20,20))
        self.name = wx.TextCtrl(self.panel, value="", pos=(110,20), size=(500,-1))
        
        self.lblPhone = wx.StaticText(self.panel, label="Phone", pos=(20,60))
        self.phone = wx.TextCtrl(self.panel, value="", pos=(110,60), size=(500,-1), validator=numOnlyValidator())
        
        self.lblAdd = wx.StaticText(self.panel, label="Address", pos=(20,100))
        self.address = wx.TextCtrl(self.panel, value="", pos=(110,100), size=(500,-1))
        
        '''
        self.lblPrevB = wx.StaticText(self.panel, label="Previous Balance\n(if any)", pos=(20,140))
        self.previousBal = wx.TextCtrl(self.panel, value="", pos=(110,140), size=(500,-1), validator=numOnlyValidator())
        '''
        
        self.saveButton =wx.Button(self.panel, label="Save", pos=(110,200))
        self.closeButton =wx.Button(self.panel, label="Close", pos=(250,200))
        
        self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
        self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
        
        self.Bind(wx.EVT_CLOSE, self.OnQuit)
        self.phone.Bind(wx.EVT_TEXT, self.findInfo)
        
        self.phone.SetFocus()
        
        self.Show() 
Example #18
Source File: dfgui.py    From PandasDataFrameGUI with MIT License 5 votes vote down vote up
def __init__(self, parent, columns, df_list_ctrl, change_callback):
        wx.Panel.__init__(self, parent)

        columns_with_neutral_selection = [''] + list(columns)
        self.columns = columns
        self.df_list_ctrl = df_list_ctrl
        self.change_callback = change_callback

        self.num_filters = 10

        self.main_sizer = wx.BoxSizer(wx.VERTICAL)

        self.combo_boxes = []
        self.text_controls = []

        for i in range(self.num_filters):
            combo_box = wx.ComboBox(self, choices=columns_with_neutral_selection, style=wx.CB_READONLY)
            text_ctrl = wx.TextCtrl(self, wx.ID_ANY, '')

            self.Bind(wx.EVT_COMBOBOX, self.on_combo_box_select)
            self.Bind(wx.EVT_TEXT, self.on_text_change)

            row_sizer = wx.BoxSizer(wx.HORIZONTAL)
            row_sizer.Add(combo_box, 0, wx.ALL, 5)
            row_sizer.Add(text_ctrl, 1, wx.ALL | wx.EXPAND | wx.ALIGN_RIGHT, 5)

            self.combo_boxes.append(combo_box)
            self.text_controls.append(text_ctrl)
            self.main_sizer.Add(row_sizer, 0, wx.EXPAND)

        self.SetSizer(self.main_sizer) 
Example #19
Source File: recipe-577951.py    From code with MIT License 5 votes vote down vote up
def __init__(self, parent, id=wx.ID_ANY, label="", pos=wx.DefaultPosition,
                 size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator,
                 name="roundbutton"):
        """
        Default class constructor.

        :param `parent`: the L{RoundButton} parent;
        :param `id`: window identifier. A value of -1 indicates a default value;
        :param `label`: the button text label;
        :param `pos`: the control position. A value of (-1, -1) indicates a default position,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `size`: the control size. A value of (-1, -1) indicates a default size,
         chosen by either the windowing system or wxPython, depending on platform;
        :param `style`: the button style (unused);
        :param `validator`: the validator associated to the button;
        :param `name`: the button name.
        """
        
        wx.PyControl.__init__(self, parent, id, pos, size, style, validator, name)

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda event: None)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
        self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
        self.Bind(wx.EVT_SET_FOCUS, self.OnGainFocus)
        self.Bind(wx.EVT_KILL_FOCUS, self.OnLoseFocus)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)

        self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown)

        self._mouseAction = None
        self._hasFocus = False
        self._buttonRadius = 0
        
        self.SetLabel(label)
        self.InheritAttributes()
        self.SetInitialSize(size) 
Example #20
Source File: convertQuotation.py    From HH---POS-Accounting-and-ERP-Software with MIT License 5 votes vote down vote up
def __init__(self, parent, iid):
        self.iid = iid
        wx.Dialog.__init__(self, parent, wx.ID_ANY, "Quotation "+self.iid, size= (650,320))
        self.panel = wx.Panel(self,wx.ID_ANY)

        self.m_cartDV = wx.dataview.DataViewListCtrl( self.panel, wx.ID_ANY, (20,20), wx.Size( 600, 180 ), 0 )
        self.m_cartDV.SetMinSize( wx.Size( -1,400 ) )
        
        self.m_cartDV.AppendTextColumn('Name')
        self.m_cartDV.AppendTextColumn('Quantity')
        self.m_cartDV.AppendTextColumn('Price')
        self.m_cartDV.AppendTextColumn('Total Price')
        
        qry = 'select p.name, pq.quantity, pq.price from products p, productquotes pq, quotations q where p.id = pq.product and  q.id = pq.quoteId and pq.quoteId = %s' % (iid)
        curs = conn.cursor()
        curs.execute(qry)
        r = curs.fetchone()
        while (1):
            if r is not None:
                self.m_cartDV.AppendItem([ r['name'], str(r['quantity']), str(r['price']), str(int(r['quantity']) * int(r['price'])) ])
                r = curs.fetchone()
            else:
                break
	
        self.lblRecMoney = wx.StaticText(self.panel, label="Recieved Money", pos=(20,220))
        self.recMoney = wx.TextCtrl(self.panel, value="", pos=(130,220), size=(90,-1), validator=numOnlyValidator())
	
        self.convertButton =wx.Button(self.panel, label="Convert to Invoice", pos=(110,260))
        self.closeButton =wx.Button(self.panel, label="Cancel", pos=(250,260))
        
        self.convertButton.Bind(wx.EVT_BUTTON, self.convertToInvoice)
        #self.convertButton.Bind(wx.EVT_BUTTON, self.asd)
        self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
        
        self.Bind(wx.EVT_CLOSE, self.OnQuit)
        
        self.Show() 
Example #21
Source File: newProd.py    From HH---POS-Accounting-and-ERP-Software with MIT License 5 votes vote down vote up
def __init__(self, parent, bc):
        wx.Dialog.__init__(self, parent, wx.ID_ANY, "New Product", size= (650,360))
        self.panel = wx.Panel(self,wx.ID_ANY)

        self.lblName = wx.StaticText(self.panel, label="Name", pos=(20,20))
        self.name = wx.TextCtrl(self.panel, value="", pos=(110,20), size=(500,-1))
        
        self.lblBarcode = wx.StaticText(self.panel, label="Barcode", pos=(20,60))
        self.barcode = wx.TextCtrl(self.panel, value="", pos=(110,60), size=(500,-1))
        self.barcode.SetValue(str(bc))
        
        self.lblCP = wx.StaticText(self.panel, label="Cost Price", pos=(20,100))
        self.costPrice = wx.TextCtrl(self.panel, value="", pos=(110,100), size=(500,-1), validator=numOnlyValidator())
        
        self.lblSP = wx.StaticText(self.panel, label="Selling Price", pos=(20,140))
        self.sellingPrice = wx.TextCtrl(self.panel, value="", pos=(110,140), size=(500,-1), validator=numOnlyValidator())
        
        self.lblQty = wx.StaticText(self.panel, label="Quantity", pos=(20,180))
        self.qty = wx.TextCtrl(self.panel, value="", pos=(110,180), size=(500,-1), validator=numOnlyValidator())
        
        self.lblmlvl = wx.StaticText(self.panel, label="Minimum Level", pos=(20,220))
        self.minLvl = wx.TextCtrl(self.panel, value="", pos=(110,220), size=(500,-1), validator=numOnlyValidator())
        
        self.lblcdn = wx.StaticText(self.panel, label="Codename", pos=(20,260))
        self.cdn = wx.TextCtrl(self.panel, value="", pos=(110,260), size=(500,-1))
        
        self.saveButton =wx.Button(self.panel, label="Save", pos=(110,300))
        self.closeButton =wx.Button(self.panel, label="Cancel", pos=(250,300))
        
        self.saveButton.Bind(wx.EVT_BUTTON, self.SaveConnString)
        self.closeButton.Bind(wx.EVT_BUTTON, self.OnQuit)
        
        self.Bind(wx.EVT_CLOSE, self.OnQuit)
        
        self.Show() 
Example #22
Source File: loginScreen.py    From HH---POS-Accounting-and-ERP-Software with MIT License 5 votes vote down vote up
def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"POS and Accounting", pos = wx.DefaultPosition, size = wx.Size( 676,460 ), style = wx.DEFAULT_FRAME_STYLE|wx.MAXIMIZE|wx.TAB_TRAVERSAL )
		
		self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
		
		bSizer1 = wx.BoxSizer( wx.VERTICAL )
		
		self.panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		
		self.mainSizer = wx.BoxSizer( wx.VERTICAL )
		
		self.userName = wx.TextCtrl (self.panel, value="admin")
		self.mainSizer.Add( self.userName, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
		
		self.passwd = wx.TextCtrl (self.panel, value="admin")
		self.mainSizer.Add( self.passwd, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
		
		self.lgnButton = wx.Button(self.panel, label="Login")
		self.mainSizer.Add( self.lgnButton, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
		
		self.panel.SetSizer( self.mainSizer )
		
		bSizer1.Add( self.panel, 1, wx.EXPAND |wx.ALL, 5 )
		
		self.SetSizer( bSizer1 )
		self.Layout()
		
		self.Centre( wx.BOTH )
		
		self.lgnButton.Bind(wx.EVT_BUTTON, self.attemptLogin) 
Example #23
Source File: loginScreen.py    From HH---POS-Accounting-and-ERP-Software with MIT License 5 votes vote down vote up
def __init__( self, parent ):
		wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"POS and Accounting", pos = wx.DefaultPosition, size = wx.Size( 676,460 ), style = wx.DEFAULT_FRAME_STYLE|wx.MAXIMIZE|wx.TAB_TRAVERSAL )
		
		self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
		
		bSizer1 = wx.BoxSizer( wx.VERTICAL )
		
		self.panel = wx.Panel( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )
		
		self.mainSizer = wx.BoxSizer( wx.VERTICAL )
		
		self.userName = wx.TextCtrl (self.panel, value="admin")
		self.mainSizer.Add( self.userName, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
		
		self.passwd = wx.TextCtrl (self.panel, value="admin")
		self.mainSizer.Add( self.passwd, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
		
		self.lgnButton = wx.Button(self.panel, label="Login")
		self.mainSizer.Add( self.lgnButton, 0, wx.ALIGN_CENTRE|wx.ALL, 5 )
		
		self.panel.SetSizer( self.mainSizer )
		
		bSizer1.Add( self.panel, 1, wx.EXPAND |wx.ALL, 5 )
		
		self.SetSizer( bSizer1 )
		self.Layout()
		
		self.Centre( wx.BOTH )
		
		self.lgnButton.Bind(wx.EVT_BUTTON, self.attemptLogin) 
Example #24
Source File: elecsus_gui.py    From ElecSus with Apache License 2.0 5 votes vote down vote up
def __init__(self,parent,style,mainwin,plottype):
		wx.PopupTransientWindow.__init__(self,parent,style)

		self.mainwin = mainwin
		self.plottype = plottype

		win = wx.Panel(self) #,wx.ID_ANY,pos=(0,0),size=(180,200),style=0)

		self.selection = wx.CheckListBox(win, wx.ID_ANY, choices = OutputPlotTypes, size=(150,-1))#,pos=(0,0))
		#self.win.Bind(wx.EVT_CHECKLISTBOX, self.OnTicked, self.selection)
		self.selection.Bind(wx.EVT_CHECKLISTBOX, self.OnTicked)
		
		if plottype == 'Theory':
			display_curves = self.mainwin.display_theory_curves
		else:
			display_curves = self.mainwin.display_expt_curves

		checked_items = []
		for i in range(len(display_curves)):
			if display_curves[i]:
				checked_items.append(i)
		self.selection.SetChecked(checked_items)

		self.SetSize(self.selection.GetSize()+(10,10))
		self.SetMinSize(self.selection.GetSize()+(10,10))
		
		popup_sizer = wx.BoxSizer(wx.VERTICAL)
		popup_sizer.Add(self.selection,0,wx.ALL, 7)
		
		win.SetSizer(popup_sizer)
		popup_sizer.Fit(win)
		self.Layout() 
Example #25
Source File: gui.py    From IkaLog with Apache License 2.0 5 votes vote down vote up
def create_buttons_ui(self):
        panel = self.frame
        self.button_last_result = wx.Button(panel, wx.ID_ANY, _('Last Result'))
        self.button_options = wx.Button(panel, wx.ID_ANY, _('Options'))

        self.buttons_layout = wx.BoxSizer(wx.HORIZONTAL)
        self.buttons_layout.Add(self.button_last_result)
        self.buttons_layout.Add(self.button_options)

        self.button_last_result.Bind(wx.EVT_BUTTON, self.on_button_results)
        self.button_options.Bind(wx.EVT_BUTTON, self.on_click_button_options) 
Example #26
Source File: PyDraw.py    From advancedpython3 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, title):
        super().__init__(None,
                         title=title,
                         size=(300, 200))

        # Set up the controller
        self.controller = PyDrawController(self)

        # Set up the layout fo the UI
        self.vertical_box_sizer = wx.BoxSizer(wx.VERTICAL)
        self.SetSizer(self.vertical_box_sizer)

        # Set up the menu bar
        self.SetMenuBar(PyDrawMenuBar())

        # Set up the toolbar
        self.vertical_box_sizer.Add(PyDrawToolBar(self),
                                    wx.ID_ANY,
                                    wx.EXPAND | wx.ALL, )

        # Setup drawing panel
        self.drawing_panel = DrawingPanel(self, self.controller.get_mode)
        self.drawing_controller = self.drawing_panel.controller

        # Add the Panel to the Frames Sizer
        self.vertical_box_sizer.Add(self.drawing_panel,
                                    wx.ID_ANY,
                                    wx.EXPAND | wx.ALL)

        # Set up the command event handling for the menu bar and tool bar
        self.Bind(wx.EVT_MENU, self.controller.command_menu_handler)

        self.Centre() 
Example #27
Source File: PyDraw.py    From advancedpython3 with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, id=wx.ID_ANY, pos=None, size=None, style=wx.TAB_TRAVERSAL):
        wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style)
        self.point = pos
        self.size = size 
Example #28
Source File: color_recognizer2.py    From color_recognizer with MIT License 5 votes vote down vote up
def __init__(self, parent, title="Color Recognizer 2"):
            wx.Frame.__init__(self, parent, size=(800, 600), style=wx.DEFAULT_DIALOG_STYLE | wx.MINIMIZE_BOX)        
            self.imgSizer = (800, 600)
            self.pnl = wx.Panel(self)
            self.vbox = wx.BoxSizer(wx.VERTICAL)
            self.image = wx.Image(self.imgSizer[0],self.imgSizer[1])
            self.imageBit = wx.Bitmap(self.image)
            self.staticBit = wx.StaticBitmap(self.pnl, wx.ID_ANY, self.imageBit)

            self.vbox.Add(self.staticBit)

            self.capture = cv2.VideoCapture(0)
            ret, self.frame = self.capture.read()
            if ret:
                self.height, self.width = self.frame.shape[:2]
                self.bmp = wx.Bitmap.FromBuffer(self.width, self.height, self.frame)
                self.timex = wx.Timer(self)
                self.timex.Start(1000./24)
                self.Bind(wx.EVT_TIMER, self.redraw)
                self.SetSize(self.imgSizer)
            else:
                print("Error no webcam image")
            self.pnl.SetSizer(self.vbox)
            self.vbox.Fit(self)

             # Create buttons
            btn_black = wx.Button(self, -1, "Black", pos=(10,20))
            btn_white = wx.Button(self, -1, "White", pos=(110,20))
            btn_red = wx.Button(self, -1, "Red", pos=(210,20))
            btn_green = wx.Button(self, -1, "Green", pos=(310,20))
            btn_blue = wx.Button(self, -1, "Blue", pos=(410,20))
            btn_orange = wx.Button(self, -1, "Orange", pos=(510,20))
            btn_yellow = wx.Button(self, -1, "Yellow", pos=(610,20))
            btn_purple = wx.Button(self, -1, "Purple", pos=(710,20))
            self.Bind(wx.EVT_BUTTON, self.OnClick)

            # Create statusbar
            self.statusbar = self.CreateStatusBar(1)
            self.statusbar.SetStatusText('None')
            self.Show() 
Example #29
Source File: gui.py    From superpaper with MIT License 5 votes vote down vote up
def draw_displays(self, use_ppi_px = False, use_multi_image = False):
        work_sz = self.GetSize()

        # draw canvas
        bmp_canv = wx.Bitmap.FromRGBA(self.dtop_canvas_relsz[0], self.dtop_canvas_relsz[1], red=0, green=0, blue=0, alpha=255)
        if not self.preview_img_list:
            # preview StaticBitmaps don't exist yet
            self.bmp_list.append(bmp_canv)
            self.st_bmp_canvas = wx.StaticBitmap(self, wx.ID_ANY, bmp_canv)
            self.st_bmp_canvas.SetPosition(self.dtop_canvas_pos)
            self.st_bmp_canvas.Hide()

            # draw monitor previews
            for disp in self.display_rel_sizes:
                size = disp[0]
                offs = disp[1]
                bmp = wx.Bitmap.FromRGBA(size[0], size[1], red=0, green=0, blue=0, alpha=255)
                self.bmp_list.append(bmp)
                st_bmp = wx.StaticBitmap(self, wx.ID_ANY, bmp)
                st_bmp.Hide()
                # st_bmp.SetScaleMode(wx.Scale_AspectFill)  # New in wxpython 4.1
                st_bmp.SetPosition(offs)
                self.preview_img_list.append(st_bmp)
        else:
            # previews exist and should be blanked
            self.current_preview_images = [] # drop chached image list

            self.st_bmp_canvas.SetBitmap(bmp_canv)
            self.st_bmp_canvas.SetPosition(self.dtop_canvas_pos)
            # self.st_bmp_canvas.Hide()

            # blank monitor previews
            for disp, st_bmp in zip(self.display_rel_sizes, self.preview_img_list):
                size = disp[0]
                offs = disp[1]
                bmp = wx.Bitmap.FromRGBA(size[0], size[1], red=0, green=0, blue=0, alpha=255)
                st_bmp.SetBitmap(bmp)
                st_bmp.SetPosition(offs)
                # st_bmp.Hide()
        self.draw_monitor_numbers(use_ppi_px)
        self.Refresh() 
Example #30
Source File: createlivestream_wx.py    From p2ptv-pi with MIT License 5 votes vote down vote up
def CreatePopupMenu(self):
        menu = wx.Menu()
        mi = menu.Append(wx.ID_ANY, 'Exit')
        self.Bind(wx.EVT_MENU, self.OnExitClient, id=mi.GetId())
        return menu