Python wx 模块,EVT_TEXT_ENTER 实例源码

我们从Python开源项目中,提取了以下31个代码示例,用于说明如何使用wx.EVT_TEXT_ENTER

项目:Digital-Assistants    作者:ab-anand    | 项目源码 | 文件源码
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.''')
项目:SameKeyProxy    作者:xzhou    | 项目源码 | 文件源码
def _bindEvents(self):
      """
      Binding events to the gui widgets.
      """
      wx.EVT_BUTTON(self, self.buttonPing.GetId(), self.OnPing)
      wx.EVT_BUTTON(self, self.buttonUpdate.GetId(), self.OnUpdate)
      wx.EVT_BUTTON(self, self.buttonClose.GetId(), self.OnClose)
      wx.EVT_BUTTON(self, self.buttonDeleteGroup.GetId(), self.OnDeleteGroup)
      wx.EVT_BUTTON(self, self.buttonCreateGroup.GetId(), self.OnCreateGroup)
      wx.EVT_BUTTON(self, self.buttonDeleteSelected.GetId(), self.OnDelete)
      wx.EVT_BUTTON(self, self.buttonRegisterItem.GetId(), self.OnRegisterItem)
      wx.EVT_BUTTON(self, self.buttonShowMeta.GetId(), self.OnShowMeta)
      wx.EVT_BUTTON(self, self.buttonSetMeta.GetId(), self.OnSetMeta)
      wx.EVT_TEXT_ENTER(self, self.txtCtrlNSHost.GetId(), self.OnCheckNS)
      wx.EVT_TEXT_ENTER(self, self.txtCtrlNSPort.GetId(), self.OnCheckNS)
      wx.EVT_CHAR(self.treeCtrlItems, self.OnKeyPressed)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initMediaPath(self):
        mediaPathControlBox = widgets.ControlBox(self, label='Media Path', orient=wx.HORIZONTAL)

        self.mediaPathTextCtrl = wx.TextCtrl(parent=self, style=wx.TE_PROCESS_ENTER)
        self.mediaPathTextCtrl.SetValue(self.pg.defaultMusicDir)
        mediaPathControlBox.Add(self.mediaPathTextCtrl, proportion=1,
                flag=wx.ALL | wx.EXPAND, border=10)
        self.Bind(wx.EVT_TEXT_ENTER, self.setMediaPath, self.mediaPathTextCtrl)
        self.offlineControls += [self.mediaPathTextCtrl]

        self.mediaBrowseButton = wx.Button(self, label='Browse')
        mediaPathControlBox.Add(self.mediaBrowseButton, proportion=0,
                flag=wx.TOP | wx.RIGHT | wx.BOTTOM, border=10)
        self.Bind(wx.EVT_BUTTON, self.mediaBrowse, self.mediaBrowseButton)
        self.offlineControls += [self.mediaBrowseButton]

        self.sizer.Add(mediaPathControlBox, proportion=0,
                flag=wx.ALL | wx.EXPAND, border=10)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initChoices(self):
        choiceControlBox = widgets.ControlBox(self, label='Choices', orient=wx.VERTICAL)

        choiceGridSizer = wx.GridSizer(1, 2, 10, 10)

        self.leftChoiceTextCtrl = wx.TextCtrl(parent=self, value=self.pg.choices[0],
                style=wx.TE_PROCESS_ENTER)
        self.Bind(wx.EVT_TEXT_ENTER, self.setChoices, self.leftChoiceTextCtrl)
        self.leftChoiceTextCtrl.Bind(wx.EVT_KILL_FOCUS, self.setChoices, self.leftChoiceTextCtrl)
        self.offlineControls += [self.leftChoiceTextCtrl]
        choiceGridSizer.Add(self.leftChoiceTextCtrl, proportion=0,
                             flag=wx.ALL | wx.EXPAND, border=10)

        self.rightChoiceTextCtrl = wx.TextCtrl(parent=self, value=self.pg.choices[1],
                style=wx.TE_PROCESS_ENTER)
        self.Bind(wx.EVT_TEXT_ENTER, self.setChoices, self.rightChoiceTextCtrl)
        self.rightChoiceTextCtrl.Bind(wx.EVT_KILL_FOCUS, self.setChoices, self.rightChoiceTextCtrl)
        self.offlineControls += [self.rightChoiceTextCtrl]
        choiceGridSizer.Add(self.rightChoiceTextCtrl, proportion=0,
                             flag=wx.ALL | wx.EXPAND, border=10)

        choiceControlBox.Add(choiceGridSizer, proportion=1,
                             flag=wx.ALL | wx.EXPAND, border=0)

        self.sizer.Add(choiceControlBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10)
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def fdir_dialogue(self, event):

        fdir = ""  # Use  folder as a flag
        currentdir = self.dirchooser.textctrl.GetValue()
        dlg = wx.DirDialog(self, defaultPath = currentdir)
        if dlg.ShowModal() == wx.ID_OK:
            fdir = dlg.GetPath() + "/"
            dlg.SetPath(fdir)
        dlg.Destroy()  # best to do this sooner than later

        if fdir:
            self.dirchooser.textctrl.SetValue(fdir)
            event = wx.PyCommandEvent(wx.EVT_TEXT_ENTER.typeId, 
                                      self.dirchooser.textctrl.GetId())
            self.GetEventHandler().ProcessEvent(event)
            self.fdir = fdir
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, parent):
        # begin wxGlade: CE_TE.__init__
        #kwds["style"] = wx.CLOSE_BOX|wx.MINIMIZE_BOX
        wx.Dialog.__init__(self, parent,id=-1,title="CE and TE")
        self.parent=parent
        self.label_1 = wx.StaticText(self, -1, "Max_CE")
        self.text_ctrl_1 = wx.TextCtrl(self, -1, "")
        self.label_2 = wx.StaticText(self, -1, "Max_TE")
        self.text_ctrl_2 = wx.TextCtrl(self, -1, "")
        self.button_1 = wx.Button(self, -1, "OK")
        self.button_2 = wx.Button(self, -1, "Cancel")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_TEXT_ENTER, self.On_TE_Enter, self.text_ctrl_1)
        self.Bind(wx.EVT_TEXT, self.On_CE_Text, self.text_ctrl_1)
        self.Bind(wx.EVT_TEXT_ENTER, self.On_TE_Enter, self.text_ctrl_2)
        self.Bind(wx.EVT_TEXT, self.On_TE_Text, self.text_ctrl_2)
        self.Bind(wx.EVT_BUTTON, self.On_Ok, self.button_1)
        self.Bind(wx.EVT_BUTTON, self.On_Cancel, self.button_2)
        # end wxGlade
项目:Automation-Bots    作者:ab-anand    | 项目源码 | 文件源码
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='KIARA')
        panel = wx.Panel(self)
        my_sizer = wx.BoxSizer(wx.VERTICAL)
        lbl = wx.StaticText(panel, label='''Hello I\'m Kiara the Python
                            Digital Assistant. 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('Welcome my friend. I am Kiara. How can I help ?')
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def __init__(self, parent, name, number, minnamelen, maxnamelen):
        wxskinDialog.__init__(self, parent, -1, "Phonebook edit entry")
        self.SetAutoLayout(True)
        self.name = None
        self.number = None
        nameTextId = wx.NewId()

        # Main window resizer object
        border = wx.BoxSizer(wx.VERTICAL)

        label = wx.StaticText(self, -1, "Enter the phonebook entry name, number and press OK.")
        border.Add(label, 1, wx.ALL, 10)

        #fgs = wx.FlexGridSizer(2,3,5,20)
        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, "Name (max %d): " % maxnamelen)
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.nameCtrl = wx.TextCtrl(self, nameTextId, name, validator = pySIMvalidator(None, minnamelen, maxnamelen))
        fgs.Add(self.nameCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, "Number (max 20): ")
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.numberCtrl = wx.TextCtrl(self, -1, number, validator = pySIMvalidator("+*#pw0123456789", None, 20))
        fgs.Add(self.numberCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.Add(wx.Button(self, ID_BUTTON_OK, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        border.Add(buttons, 1, wx.ALL)

        wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK)
        wx.EVT_TEXT_ENTER(self, nameTextId, self.onOK)

        self.SetAutoLayout(1);
        self.SetSizer(border)
        border.Fit(self)
        self.Layout()
项目:SIMreader    作者:stoic1979    | 项目源码 | 文件源码
def __init__(self, parent, name, number, minnamelen, maxnamelen):
        wxskinDialog.__init__(self, parent, -1, "Phonebook edit entry")
        self.SetAutoLayout(True)
        self.name = None
        self.number = None
        nameTextId = wx.NewId()

        # Main window resizer object
        border = wx.BoxSizer(wx.VERTICAL)

        label = wx.StaticText(self, -1, "Enter the phonebook entry name, number and press OK.")
        border.Add(label, 1, wx.ALL, 10)

        #fgs = wx.FlexGridSizer(2,3,5,20)
        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, "Name (max %d): " % maxnamelen)
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.nameCtrl = wx.TextCtrl(self, nameTextId, name, validator = pySIMvalidator(None, minnamelen, maxnamelen))
        fgs.Add(self.nameCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        fgs = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1, "Number (max 20): ")
        fgs.Add(label, 1, wx.ALIGN_LEFT | wx.LEFT, 10)
        self.numberCtrl = wx.TextCtrl(self, -1, number, validator = pySIMvalidator("+*#pw0123456789", None, 20))
        fgs.Add(self.numberCtrl, 1, wx.ALIGN_RIGHT | wx.RIGHT, 10)
        border.Add(fgs, 1, wx.ALL)

        buttons = wx.BoxSizer(wx.HORIZONTAL)
        buttons.Add(wx.Button(self, ID_BUTTON_OK, "Okay"), 1, wx.ALIGN_LEFT | wx.ALL, 20)
        buttons.Add(wx.Button(self, wx.ID_CANCEL, "Cancel"), 1, wx.ALIGN_RIGHT | wx.ALL, 20)
        border.Add(buttons, 1, wx.ALL)

        wx.EVT_BUTTON(self, ID_BUTTON_OK, self.onOK)
        wx.EVT_TEXT_ENTER(self, nameTextId, self.onOK)

        self.SetAutoLayout(1);
        self.SetSizer(border)
        border.Fit(self)
        self.Layout()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def initChoices(self):
        choiceControlBox = widgets.ControlBox(self, label='Choices', orient=wx.VERTICAL)

        self.choiceTextCtrl = wx.TextCtrl(parent=self, value=', '.join(self.pg.choices),
                style=wx.TE_PROCESS_ENTER)
        self.Bind(wx.EVT_TEXT_ENTER, self.setChoices, self.choiceTextCtrl)
        self.choiceTextCtrl.Bind(wx.EVT_KILL_FOCUS, self.setChoices, self.choiceTextCtrl)
        self.offlineControls += [self.choiceTextCtrl]
        choiceControlBox.Add(self.choiceTextCtrl, proportion=1,
                             flag=wx.ALL | wx.EXPAND, border=10)

        self.sizer.Add(choiceControlBox, proportion=0, flag=wx.ALL | wx.EXPAND, border=10)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
        self.panelphase = self.GetParent().GetParent().GetParent()
        self.font = self.GetParent().font
        self.file = None
        vbox = wx.BoxSizer(wx.VERTICAL)
        title = wx.StaticText(self, label="Convert HDF5 to Numpy array.")
        vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.input_filename = TextPanelObject(self, "Input HDF5 File: ", "",150,"HDF files (*.hdf)|*.hdf|HDF5 files (*.h5)|*.h5|All files (*.*)|*.*")
        vbox.Add(self.input_filename, 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1,"HDF Key Path:" , style =wx.ALIGN_RIGHT, size=(150,-1) )
        label.SetFont(self.font)
        hbox.Add( label, 0, wx.CENTER )
        def OnEdit(event):
            self.objectpath.ChangeValue(event.GetString())
        self.objectpath = TextCtrlNew(self, -1)
        self.objectpath.SetFont(self.font)
        self.objectpath.SetValue("")
        self.objectpath.SetToolTipNew("Comma separated key names.")
        self.objectpath.Bind(wx.EVT_TEXT_ENTER, OnEdit)
        hbox.Add( self.objectpath, 1, wx.CENTER |wx.EXPAND )
        self.button = ButtonNew(self, -1, "Browse")
        self.button.SetFont(self.font)
        self.button.SetToolTipNew("Browse for HDF5 key path.")
        self.button.Bind(wx.EVT_BUTTON, self.OnBrowse)
        hbox.Add( self.button, 0, wx.LEFT|wx.CENTER)
        vbox.Add(hbox, 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.output_filename = TextPanelObject(self, "Output File: ", "output.npy",150,'*.npy')
        vbox.Add(self.output_filename, 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.SetAutoLayout(True)
        self.SetSizer( vbox )
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.ancestor = parent
        self.filename = ""
        self.dirname = '.'
        self.vbox = wx.BoxSizer(wx.VERTICAL)
        self.log= wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL)
        self.vbox.Add(self.log, 1, wx.EXPAND | wx.ALL, 2)
        self.vbox.AddSpacer(2)
        self.hbox_ent = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox_ent.AddSpacer(20)
        self.font = self.ancestor.GetParent().font
        self.label = wx.StaticText(self, -1,"Log Entry:", style=wx.ALIGN_CENTRE_HORIZONTAL, size=(160,-1) )
        self.label.SetFont(self.font)
        self.hbox_ent.Add( self.label, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 2)
        self.entry = wx.TextCtrl(self, -1, style=wx.TE_PROCESS_ENTER)
        self.entry.SetFont(self.font)
        self.entry.SetValue("")
        if IsNotWX4():
            self.entry.SetToolTipString("Enter comments into the log here.")
        else:
            self.entry.SetToolTip("Enter comments into the log here.")
        self.entry.Bind(wx.EVT_TEXT_ENTER, self.OnEnterComments)
        self.hbox_ent.Add( self.entry, 1, wx.EXPAND | wx.LEFT | wx.RIGHT)
        self.vbox.Add(self.hbox_ent, 0, wx.EXPAND)
        self.hbox_btn = wx.BoxSizer(wx.HORIZONTAL)
        self.hbox_btn.AddSpacer(20)
        self.button_save =wx.Button(self, label="Save Log")
        self.Bind(wx.EVT_BUTTON, self.OnClickSaveButton, self.button_save)
        self.hbox_btn.Add(self.button_save)
        self.button_clear =wx.Button(self, label="Clear Log")
        self.Bind(wx.EVT_BUTTON, self.OnClickClearButton, self.button_clear)
        self.hbox_btn.Add(self.button_clear)
        self.vbox.Add(self.hbox_btn, 0, wx.EXPAND)
        self.SetSizerAndFit(self.vbox)
        self.redir=RedirectText(self.log)
        sys.stdout=self.redir
        self.data_poll_timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.UpdateLog, self.data_poll_timer)
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent, name, objectpath, textwidth, file_extension):
        def assign(input):
            self.objectpath.ChangeValue(input)
        def OnBrowse(self):
            if IsNotWX4():
                dlg = wx.FileDialog(parent, 'Choose a file', os.getcwd(), '',  file_extension, wx.OPEN)
            else:
                dlg = wx.FileDialog(parent, 'Choose a file', os.getcwd(), '',  file_extension, wx.FD_OPEN)
            if dlg.ShowModal() == wx.ID_OK:
                assign(dlg.GetPath())
            dlg.Destroy()
        def OnEdit(event):
            self.objectpath.ChangeValue(event.GetString())
        fontpointsize=wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPointSize()
        self.font = wx.Font(fontpointsize, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
        dc = wx.ScreenDC()
        dc.SetFont(self.font)
        textw,texth = dc.GetTextExtent(name)
        if textw > textwidth:
            labelw = textw
        else:
            labelw = textwidth
        wx.BoxSizer.__init__(self, wx.HORIZONTAL)
        self.label = StaticTextNew(parent, -1, name, style =wx.ALIGN_RIGHT, size=(labelw,-1) )
        self.label.SetFont(self.font)
        self.Add( self.label, 0, wx.CENTER )
        self.objectpath = TextCtrlNew(parent, -1)
        self.objectpath.SetFont(self.font)
        self.objectpath.SetValue(objectpath)
        self.objectpath.SetToolTipNew("Browse for file or type "+os.linesep+"path and name")
        self.objectpath.Bind(wx.EVT_TEXT_ENTER, OnEdit)
        self.Add( self.objectpath, 1, wx.CENTER |wx.EXPAND )
        self.button = ButtonNew(parent, -1, "Browse")
        self.button.SetFont(self.font)
        self.button.SetToolTipNew("Browse for file or type "+os.linesep+"path and name")
        self.button.Bind(wx.EVT_BUTTON, OnBrowse)
        self.Add( self.button, 0, wx.LEFT|wx.CENTER)
项目:Supplicant    作者:mayuko2012    | 项目源码 | 文件源码
def _EnableOrDisableOkBtn(self):
        self.Bind(wx.EVT_TEXT_ENTER,self.Onnone,self.pwd)
        self.connect.Disable()
        usrStr = self.username.GetValue()
        pwdStr = self.pwd.GetValue()
        if not usrStr=='' and not pwdStr=='':
            self.connect.Enable()
            self.Bind(wx.EVT_TEXT_ENTER,self.OnConnect,self.pwd)
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def redraw_plot(self):
        ax, data = self.get_plot_data()
        xlabel = self.field.axislabels[self.normal] 
        ylabel = self.fieldname + "_" + self.field.labels[self.component] 
        self.pyplotp.redraw_plot(ax, data, xlabel, ylabel)

        # Set min/max text values
        self.minp, self.maxp = self.pyplotp.ax.get_ylim()
        self.choosep.minpspin.SetValue(str(round_to_n(self.minp,3)))
        self.choosep.maxpspin.SetValue(str(round_to_n(self.maxp,3)))
        #self.post_string_event(wx.EVT_TEXT_ENTER,self.round_to_n(self.minp,6),self.choosep.minpspin)
        #self.post_string_event(wx.EVT_TEXT_ENTER,self.round_to_n(self.maxp,6),self.choosep.maxpspin)
        self.Refresh()
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def redraw_contour(self):
        ax1, ax2, data, naxes = self.get_contour_data()
        xlabel = naxes[0]
        ylabel = naxes[1]
        self.pyplotp.redraw_contour(ax1, ax2, data, xlabel, ylabel)
        # Set min/max contour values
        self.minp,self.maxp = self.pyplotp.colormesh.get_clim()
        self.choosep.minpspin.SetValue(str(round_to_n(self.minp,3)))
        self.choosep.maxpspin.SetValue(str(round_to_n(self.maxp,3)))
        #self.post_string_event(wx.EVT_TEXT_ENTER,self.round_to_n(self.minp,6),self.choosep.minpspin)
        #self.post_string_event(wx.EVT_TEXT_ENTER,self.round_to_n(self.maxp,6),self.choosep.maxpspin)
        self.Refresh()
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def set_bindings(self):

        self.Bind(wx.EVT_TEXT_ENTER, self.handle_chdir, 
                  self.dirchooser.textctrl)
        self.Bind(wx.EVT_BUTTON, self.fdir_dialogue, 
                  self.dirchooser.changebutton)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Dialog.__init__(self, parent, title=_('Edit Duration'))

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

        controls_sizer = wx.FlexGridSizer(cols=len(CONTROLS), hgap=10, rows=2, vgap=10)
        main_sizer.AddSizer(controls_sizer, border=20,
                            flag=wx.TOP | wx.LEFT | wx.RIGHT | wx.GROW)

        controls = []
        for i, (name, label) in enumerate(CONTROLS):
            controls_sizer.AddGrowableCol(i)

            st = wx.StaticText(self, label=label)
            txtctrl = wx.TextCtrl(self, value='0', style=wx.TE_PROCESS_ENTER)
            self.Bind(wx.EVT_TEXT_ENTER,
                      self.GetControlValueTestFunction(txtctrl),
                      txtctrl)
            setattr(self, name, txtctrl)

            controls.append((st, txtctrl))

        for st, txtctrl in controls:
            controls_sizer.AddWindow(st, flag=wx.GROW)

        for st, txtctrl in controls:
            controls_sizer.AddWindow(txtctrl, flag=wx.GROW)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL | wx.CENTRE)
        self.Bind(wx.EVT_BUTTON, self.OnOK, button_sizer.GetAffirmativeButton())
        main_sizer.AddSizer(button_sizer, border=20,
                            flag=wx.ALIGN_RIGHT | wx.BOTTOM | wx.LEFT | wx.RIGHT)

        self.SetSizer(main_sizer)
        self.Fit()
        self.Days.SetFocus()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def AddSizerParams(self, parent, sizer, params):
        for idx, (name, label) in enumerate(params):
            border = 0
            if idx == 0:
                border |= wx.TOP
            elif idx == len(params) - 1:
                border |= wx.BOTTOM

            st = wx.StaticText(parent, label=label)
            sizer.AddWindow(st, border=10,
                            flag=wx.ALIGN_CENTER_VERTICAL | border | wx.LEFT)

            tc = wx.TextCtrl(parent, style=wx.TE_PROCESS_ENTER)
            setattr(self, name, tc)
            callback = self.GetTextCtrlChangedFunction(tc, name)
            self.Bind(wx.EVT_TEXT_ENTER, callback, tc)
            tc.Bind(wx.EVT_KILL_FOCUS, callback)
            sizer.AddWindow(tc, border=10,
                            flag=wx.GROW | border | wx.RIGHT)
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent, choices=None, dropDownClick=True,
                 element_path=None, **therest):
        """
        Constructor works just like wx.TextCtrl except you can pass in a
        list of choices.  You can also change the choice list at any time
        by calling setChoices.
        """

        therest['style'] = wx.TE_PROCESS_ENTER | therest.get('style', 0)

        wx.TextCtrl.__init__(self, parent, **therest)

        # Some variables
        self._dropDownClick = dropDownClick
        self._lastinsertionpoint = None
        self._hasfocus = False

        self._screenheight = wx.SystemSettings.GetMetric(wx.SYS_SCREEN_Y)
        self.element_path = element_path

        self.listbox = None

        self.SetChoices(choices)

        # gp = self
        # while ( gp != None ) :
        #    gp.Bind ( wx.EVT_MOVE , self.onControlChanged, gp )
        #    gp.Bind ( wx.EVT_SIZE , self.onControlChanged, gp )
        #    gp = gp.GetParent()

        self.Bind(wx.EVT_KILL_FOCUS, self.OnControlChanged)
        self.Bind(wx.EVT_TEXT_ENTER, self.OnControlChanged)
        self.Bind(wx.EVT_TEXT, self.OnEnteredText)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)

        # If need drop down on left click
        if dropDownClick:
            self.Bind(wx.EVT_LEFT_DOWN, self.OnClickToggleDown)
            self.Bind(wx.EVT_LEFT_UP, self.OnClickToggleUp)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        """Constructor"""
        wx.Dialog.__init__(self, None, title="Login")
        self.logged_in = False

        # user info
        user_sizer = wx.BoxSizer(wx.HORIZONTAL)

        user_lbl = wx.StaticText(self, label="Username:")
        user_sizer.Add(user_lbl, 0, wx.ALL|wx.CENTER, 5)
        self.user = wx.TextCtrl(self)
        user_sizer.Add(self.user, 0, wx.ALL, 5)

        # pass info
        p_sizer = wx.BoxSizer(wx.HORIZONTAL)

        p_lbl = wx.StaticText(self, label="Password:")
        p_sizer.Add(p_lbl, 0, wx.ALL|wx.CENTER, 5)
        self.password = wx.TextCtrl(self, style=wx.TE_PASSWORD|wx.TE_PROCESS_ENTER)
        self.password.Bind(wx.EVT_TEXT_ENTER, self.onLogin)
        p_sizer.Add(self.password, 0, wx.ALL, 5)

        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(user_sizer, 0, wx.ALL, 5)
        main_sizer.Add(p_sizer, 0, wx.ALL, 5)

        btn = wx.Button(self, label="Login")
        btn.Bind(wx.EVT_BUTTON, self.onLogin)
        main_sizer.Add(btn, 0, wx.ALL|wx.CENTER, 5)

        self.SetSizer(main_sizer)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def __init__(self, parent, id, title):
        wx.Frame.__init__(self,parent,wx.ID_ANY, title, size=(600, 600), pos=(200, 200))

        self.splitter_window = wx.SplitterWindow(self, -1, style=wx.SP_3D|wx.SP_BORDER)
        self.splitter_window.SetMinimumPaneSize(20)
        self.left_panel = wx.Panel(self.splitter_window, -1)
        self.right_panel = wx.Panel(self.splitter_window, -1)

        self.tree = CT.CustomTreeCtrl(self.left_panel, 1002, pos=(0, 0), 
            style=wx.TR_DEFAULT_STYLE | 
            wx.TR_HAS_VARIABLE_ROW_HEIGHT | 
            wx.TR_HAS_BUTTONS | 
            wx.TR_FULL_ROW_HIGHLIGHT | 
            wx.TR_MULTIPLE | 
            wx.TR_EDIT_LABELS)
        self.root = self.tree.AddRoot("Root Item")

        offset_lists = ["Clearance Reports", "Other Offsets"]
        offset_list_combo_box = wx.ComboBox(self.right_panel, -1, choices=offset_lists)

        #Sizers
        offset_sizer = wx.BoxSizer(wx.VERTICAL)
        offset_sizer.Add(offset_list_combo_box, 0, wx.EXPAND)
        vbox = wx.BoxSizer(wx.VERTICAL)
        vbox.Add(self.tree, 1, wx.EXPAND)
        self.left_panel.SetSizer(vbox)
        vbox2 = wx.BoxSizer(wx.VERTICAL)
        vbox2.Add(offset_sizer, 1, wx.EXPAND)
        self.right_panel.SetSizer(vbox2)
        main_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.splitter_window.SplitVertically(self.left_panel, self.right_panel)
        main_sizer.Add(self.splitter_window, 1, wx.EXPAND)
        self.SetSizer(main_sizer)

        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnEndLabelEdit)
        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.OnBeginLabelEdit)
        self.Bind(wx.EVT_KEY_DOWN, self.enterpressed)
        self.tree.Bind(wx.EVT_KEY_DOWN, self.enterpressed)
        self.Bind(wx.EVT_KEY_DOWN, self.enterpressed, self.tree)
        self.Bind(wx.EVT_COMMAND_ENTER, self.enterpressed)
        self.Bind(wx.EVT_TEXT_ENTER, self.enterpressed)

        self.Show(True)
项目:CAAPR    作者:Stargrazer82301    | 项目源码 | 文件源码
def __init__(self, parent, raw_header_str, caption,
                 pos=wx.DefaultPosition, size=(500,300),
                 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
        self.parent = parent
        wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
        x, y = pos
        if x == -1 and y == -1:
            self.CenterOnScreen(wx.BOTH)
        self.cur_selection = (0, 0)
        self.raw_header_str = raw_header_str
        self.raw_header_str_lower = raw_header_str.lower()
        self.text = text = wx.TextCtrl(self, -1, raw_header_str, style=wx.TE_MULTILINE | wx.TE_READONLY)

        font1 = wx.Font(12, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.FONTWEIGHT_LIGHT, False)
        self.text.SetFont(font1)
        self.text.SetInitialSize((600,400))

        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(self.text, 1, wx.EXPAND | wx.ALL, border=5)
        ok = wx.Button(self, wx.ID_OK, "OK")
        ok.SetDefault()
        ok.Bind(wx.EVT_BUTTON, self.on_close)

        buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.search = wx.SearchCtrl(self, size=(200, -1), style=wx.TE_PROCESS_ENTER)
        self.search.ShowSearchButton(True)
        self.search.ShowCancelButton(True)
        # TODO:  make layout of search & OK button prettier (OK should be right-aligned properly)
        buttons_sizer.Add(self.search, 0, wx.ALL | wx.EXPAND)
        buttons_sizer.Add((315, 0), 1, wx.EXPAND)
        buttons_sizer.Add(ok, 0, wx.ALL)
        main_sizer.Add(buttons_sizer, 0, wx.ALL, border=4)
        self.SetSizerAndFit(main_sizer)
        self.set_cur_selection()
        self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_search, self.search)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_search, self.search)
        self.last_search_str = ''
        self.last_find_index = 0
        self.is_dialog_still_open = True
        self.Bind(wx.EVT_CLOSE, self.on_close)
        new_id = wx.NewId()
        self.Bind(wx.EVT_MENU, self.on_cmd_w, id=new_id)
        self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CMD, ord(str('w')), new_id)]))
项目:CAAPR    作者:Stargrazer82301    | 项目源码 | 文件源码
def __init__(self, parent, raw_header_str, caption,
                 pos=wx.DefaultPosition, size=(500,300),
                 style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
        self.parent = parent
        wx.Dialog.__init__(self, parent, -1, caption, pos, size, style)
        x, y = pos
        if x == -1 and y == -1:
            self.CenterOnScreen(wx.BOTH)
        self.cur_selection = (0, 0)
        self.raw_header_str = raw_header_str
        self.raw_header_str_lower = raw_header_str.lower()
        self.text = text = wx.TextCtrl(self, -1, raw_header_str, style=wx.TE_MULTILINE | wx.TE_READONLY)

        font1 = wx.Font(12, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.FONTWEIGHT_LIGHT, False)
        self.text.SetFont(font1)
        self.text.SetInitialSize((600,400))

        main_sizer = wx.BoxSizer(wx.VERTICAL)
        main_sizer.Add(self.text, 1, wx.EXPAND | wx.ALL, border=5)
        ok = wx.Button(self, wx.ID_OK, "OK")
        ok.SetDefault()
        ok.Bind(wx.EVT_BUTTON, self.on_close)

        buttons_sizer = wx.BoxSizer(wx.HORIZONTAL)
        self.search = wx.SearchCtrl(self, size=(200, -1), style=wx.TE_PROCESS_ENTER)
        self.search.ShowSearchButton(True)
        self.search.ShowCancelButton(True)
        # TODO:  make layout of search & OK button prettier (OK should be right-aligned properly)
        buttons_sizer.Add(self.search, 0, wx.ALL | wx.EXPAND)
        buttons_sizer.Add((315, 0), 1, wx.EXPAND)
        buttons_sizer.Add(ok, 0, wx.ALL)
        main_sizer.Add(buttons_sizer, 0, wx.ALL, border=4)
        self.SetSizerAndFit(main_sizer)
        self.set_cur_selection()
        self.Bind(wx.EVT_SEARCHCTRL_SEARCH_BTN, self.on_search, self.search)
        self.Bind(wx.EVT_TEXT_ENTER, self.on_search, self.search)
        self.last_search_str = ''
        self.last_find_index = 0
        self.is_dialog_still_open = True
        self.Bind(wx.EVT_CLOSE, self.on_close)
        new_id = wx.NewId()
        self.Bind(wx.EVT_MENU, self.on_cmd_w, id=new_id)
        self.SetAcceleratorTable(wx.AcceleratorTable([(wx.ACCEL_CMD, ord(str('w')), new_id)]))
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent, style=wx.SUNKEN_BORDER)
        self.panelphase = self.GetParent().GetParent().GetParent()
        self.font = self.GetParent().font
        self.file = None
        vbox = wx.BoxSizer(wx.VERTICAL)
        title = wx.StaticText(self, label="Fill blank voxels lines in raw data.")
        vbox.Add(title ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.input_filename = TextPanelObject(self, "Input File: ", "",150,"Numpy files (*.npy)|*.npy|All files (*.*)|*.*")
        vbox.Add(self.input_filename, 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        label = wx.StaticText(self, -1,"ROI:" , style =wx.ALIGN_RIGHT, size=(150,-1) )
        label.SetFont(self.font)
        hbox.Add( label, 0, wx.CENTER )
        def OnEdit(event):
            self.objectpath.ChangeValue(event.GetString())
        self.objectpath = TextCtrlNew(self, -1)
        self.objectpath.SetFont(self.font)
        self.objectpath.SetValue("")
        self.objectpath.SetToolTipNew("Region of Interest")
        self.objectpath.Bind(wx.EVT_TEXT_ENTER, OnEdit)
        hbox.Add( self.objectpath, 1, wx.CENTER |wx.EXPAND )
        self.button = ButtonNew(self, -1, "Browse")
        self.button.SetFont(self.font)
        self.button.SetToolTipNew("Browse for ROI.")
        self.button.Bind(wx.EVT_BUTTON, self.OnBrowse)
        hbox.Add( self.button, 0, wx.LEFT|wx.CENTER)
        vbox.Add(hbox, 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.output_filename = TextPanelObject(self, "Output File: ", "output.npy",150,'*.npy')
        vbox.Add(self.output_filename, 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        vbox.Add((0,10))
        title2 = wx.StaticText(self, label="Filter kernel dimensions: ")
        vbox.Add(title2 ,0, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.kdims=[{} for i in range(3)]
        self.kdims[0] = SpinnerObject(self,"x",MAX_INT_16,1,1,3,20,60)
        self.kdims[1] = SpinnerObject(self,"y",MAX_INT_16,1,1,3,20,60)
        self.kdims[2] = SpinnerObject(self,"z",MAX_INT_16,1,1,1,20,60)
        hbox1 = wx.BoxSizer(wx.HORIZONTAL)
        hbox1.Add(self.kdims[0], 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10)
        hbox1.Add(self.kdims[1], 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10)
        hbox1.Add(self.kdims[2], 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.BOTTOM, border=10)
        vbox.Add(hbox1, 0,  flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        self.SetAutoLayout(True)
        self.SetSizer( vbox )
项目:JincinExamHelper    作者:Qinet    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(WebPanel, self).__init__(parent=parent)
        self.current_url = HOMEURL
        sizer = wx.BoxSizer(orient=wx.VERTICAL)
        btn_sizer = wx.BoxSizer(orient=wx.HORIZONTAL)
        self.web_view = webview.WebView.New(parent=self)
        self.Bind(event=webview.EVT_WEBVIEW_LOADED, handler=self.webview_loaded, source=self.web_view)
        self.Bind(event=webview.EVT_WEBVIEW_NEWWINDOW, handler=self.open_new_window, source=self.web_view)

        btn_home = wx.Button(parent=self, label=u"??", style=wx.BU_EXACTFIT)
        self.Bind(event=wx.EVT_BUTTON, handler=self.click_home_button, source=btn_home)
        btn_sizer.Add(item=btn_home, proportion=CAN_NOT_CHANGE, flag=wx.EXPAND | wx.ALL, border=2)

        btn_back_page = wx.Button(parent=self, label=u"<--", style=wx.BU_EXACTFIT)
        self.Bind(event=wx.EVT_BUTTON, handler=self.click_preview_page_button, source=btn_back_page)
        self.Bind(event=wx.EVT_UPDATE_UI, handler=self.check_can_goback, source=btn_back_page)
        btn_sizer.Add(item=btn_back_page, proportion=CAN_NOT_CHANGE, flag=wx.EXPAND | wx.ALL, border=2)

        btn_next_page = wx.Button(parent=self, label=u"-->", style=wx.BU_EXACTFIT)
        self.Bind(event=wx.EVT_BUTTON, handler=self.click_next_page_button, source=btn_next_page)
        self.Bind(event=wx.EVT_UPDATE_UI, handler=self.check_can_goforward, source=btn_next_page)
        btn_sizer.Add(item=btn_next_page, proportion=CAN_NOT_CHANGE, flag=wx.EXPAND | wx.ALL, border=2)

        btn_stop = wx.Button(parent=self, label=u"??", style=wx.BU_EXACTFIT)
        self.Bind(event=wx.EVT_BUTTON, handler=self.click_stop_button, source=btn_stop)
        btn_sizer.Add(item=btn_stop, proportion=CAN_NOT_CHANGE, flag=wx.EXPAND | wx.ALL, border=2)

        btn_refresh = wx.Button(parent=self, label=u"??", style=wx.BU_EXACTFIT)
        self.Bind(event=wx.EVT_BUTTON, handler=self.click_refresh_page_button, source=btn_refresh)
        btn_sizer.Add(btn_refresh, proportion=CAN_NOT_CHANGE, flag=wx.EXPAND | wx.ALL, border=2)

        url_bar_title = wx.StaticText(parent=self, label=u"??:")
        btn_sizer.Add(url_bar_title, proportion=CAN_NOT_CHANGE, flag=wx.CENTER | wx.ALL, border=2)

        self.location = wx.ComboBox(parent=self, value=wx.EmptyString, style=wx.CB_DROPDOWN | wx.TE_PROCESS_ENTER)
        self.location.Bind(event=wx.EVT_TEXT_ENTER, handler=self.enter_location)
        self.Bind(event=wx.EVT_COMBOBOX, handler=self.select_location, source=self.location)
        btn_sizer.Add(item=self.location, proportion=CAN_CHANGE, flag=wx.EXPAND | wx.ALL, border=2)

        sizer.Add(item=btn_sizer, proportion=CAN_NOT_CHANGE, flag=wx.EXPAND)
        sizer.Add(item=self.web_view, proportion=CAN_CHANGE, flag=wx.EXPAND)
        self.SetSizer(sizer=sizer)

        self.web_view.LoadURL(url=self.current_url)
项目:pyjam    作者:10se1ucgo    | 项目源码 | 文件源码
def __init__(self, parent):
        super(SearchDialog, self).__init__(parent=parent, title="pyjam Audio Search")
        self.parent = parent

        self.result_list = ObjectListView(parent=self, style=wx.LC_REPORT | wx.BORDER_SUNKEN, sortable=True,
                                          useAlternateBackColors=False)
        self.result_list.SetEmptyListMsg("No results")
        self.result_list.SetColumns([
            ColumnDefn(title="Title", valueGetter="title", width=150),
            ColumnDefn(title="Description", valueGetter="desc", width=300)
        ])

        self.search_recent = collections.deque([], 10)
        search_help = wx.StaticText(parent=self, label=("Enter a search term and press Enter. "
                                                        "Then, select the videos you want from the list and press OK."))
        self.search_query = wx.SearchCtrl(parent=self, style=wx.TE_PROCESS_ENTER)
        self.search_query.ShowCancelButton(True)
        self.search_query.SetMenu(self.search_menu())

        top_sizer = wx.BoxSizer(wx.VERTICAL)
        olv_sizer = wx.BoxSizer(wx.VERTICAL)
        query_sizer = wx.BoxSizer(wx.VERTICAL)

        button_sizer = self.CreateButtonSizer(wx.OK | wx.CANCEL)

        olv_sizer.Add(self.result_list, 1, wx.LEFT | wx.RIGHT | wx.EXPAND | wx.ALIGN_TOP, 5)
        query_sizer.Add(search_help, 0, wx.ALL ^ wx.TOP, 5)
        query_sizer.Add(self.search_query, 0, wx.ALL ^ wx.TOP | wx.EXPAND, 5)
        top_sizer.Add(olv_sizer, 1, wx.ALL | wx.EXPAND, 5)
        top_sizer.Add(query_sizer, 0, wx.ALL | wx.EXPAND, 5)
        top_sizer.Add(button_sizer, 0, wx.ALL | wx.ALIGN_CENTER, 5)

        # Context menu
        self.context_menu = wx.Menu()
        open_url = self.context_menu.Append(wx.ID_OPEN, "Open link in browser")
        copy_url = self.context_menu.Append(wx.ID_COPY, "Copy link address")

        self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, handler=self.list_right_click, source=self.result_list)
        self.Bind(wx.EVT_MENU, handler=self.copy_url, source=copy_url)
        self.Bind(wx.EVT_MENU, handler=self.open_url, source=open_url)

        self.Bind(wx.EVT_TEXT_ENTER, handler=self.on_search, source=self.search_query)
        self.Bind(wx.EVT_BUTTON, handler=self.on_ok, id=wx.ID_OK)
        self.SetSizerAndFit(top_sizer)
        self.Center()
        self.ShowModal()
项目:pyDataView    作者:edwardsmith999    | 项目源码 | 文件源码
def set_bindings(self):

        self.Bind(wx.EVT_RADIOBOX, self.handle_plottype, 
                  self.choosep.plottype_p.fieldradiobox)
        self.Bind(wx.EVT_RADIOBOX, self.handle_fieldtype, 
                  self.choosep.fieldtype_p.fieldradiobox)
        self.Bind(wx.EVT_COMBOBOX, self.handle_component, 
                  self.choosep.component_p.componentcombobox)
        self.Bind(wx.EVT_COMBOBOX, self.handle_normal, 
                  self.choosep.component_p.normalcombobox)

        self.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK, self.handle_recslider, 
                  self.slidersp.recslider.slider)
        self.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK, self.handle_binslider, 
                  self.slidersp.binslider.slider)
        self.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.handle_recslider, 
                  self.slidersp.recslider.slider)
        self.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.handle_binslider, 
                  self.slidersp.binslider.slider)
        self.Bind(wx.EVT_TEXT_ENTER, self.handle_rectxt,
                  self.slidersp.recslider.slidertext)
        self.Bind(wx.EVT_TEXT_ENTER, self.handle_bintxt,
                  self.slidersp.binslider.slidertext)

        self.Bind(wx.EVT_SPINCTRL, self.handle_recspin,
                  self.slidersp.recslider.spin)
        self.Bind(wx.EVT_SPINCTRL, self.handle_binspin,
                  self.slidersp.binslider.spin)

        self.Bind(wx.EVT_CHECKBOX, self.handle_autoscale, 
                  self.choosep.autoscale_b) 
        self.Bind(wx.EVT_TEXT_ENTER, self.handle_minscale, 
                  self.choosep.minpspin) 
        self.Bind(wx.EVT_TEXT_ENTER, self.handle_maxscale, 
                  self.choosep.maxpspin) 

        self.choosep.save_b.Bind(wx.EVT_BUTTON, 
                                 lambda event: self.save_dialogue(event, 'fig.png'))
        self.choosep.save_d.Bind(wx.EVT_BUTTON, 
                                 lambda event: self.save_dialogue(event, 'data.csv'))
        self.choosep.save_s.Bind(wx.EVT_BUTTON, 
                                 lambda event: self.save_dialogue(event, 'script.py'))
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: sampoorna_win.__init__
        kwds["style"] = wx.DEFAULT_FRAME_STYLE
        wx.Frame.__init__(self, *args, **kwds)
        self.notebook_1 = wx.Notebook(self, wx.ID_ANY, style=0)
        self.login_pane = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.panel_login = wx.Panel(self.login_pane, wx.ID_ANY)
        self.label_1 = wx.StaticText(self.panel_login, wx.ID_ANY, _("Warning: Always backup your database before you proceed to avoid potential data loss !!!"))
        self.label_2 = wx.StaticText(self.panel_login, wx.ID_ANY, _("This software does not save Sampoorna credentials. It is used for one time login"))
        self.panel_1 = wx.Panel(self.panel_login, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.TAB_TRAVERSAL)
        self.label_3 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Username"))
        self.text_ctrl_user = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.NO_BORDER)
        self.label_4 = wx.StaticText(self.panel_1, wx.ID_ANY, _("Sampoorna Password"))
        self.text_ctrl_passw = wx.TextCtrl(self.panel_1, wx.ID_ANY, "", style=wx.TE_PROCESS_ENTER | wx.TE_PASSWORD | wx.NO_BORDER)
        self.button_next = wx.Button(self.panel_login, wx.ID_ANY, _("Next >>"))
        self.standard_pane = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.panel_3 = wx.Panel(self.standard_pane, wx.ID_ANY, style=wx.SUNKEN_BORDER | wx.RAISED_BORDER | wx.STATIC_BORDER | wx.TAB_TRAVERSAL)
        self.checkbox_8 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("8 Standard"))
        self.checkbox_9 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("9 Standard"))
        self.checkbox_10 = wx.CheckBox(self.panel_3, wx.ID_ANY, _("10 Standard"))
        self.button_next_copy_copy = wx.Button(self.standard_pane, wx.ID_ANY, _("<<Previous"))
        self.button_next_copy = wx.Button(self.standard_pane, wx.ID_ANY, _("Proceed >>"))
        self.report_pane = wx.Panel(self.notebook_1, wx.ID_ANY)
        self.panel_2 = wx.Panel(self.report_pane, wx.ID_ANY)
        self.label_7 = wx.StaticText(self.panel_2, wx.ID_ANY, _("Progress"))
        self.progresss_total = wx.TextCtrl(self.panel_2, wx.ID_ANY, "")
        self.progress_each = wx.TextCtrl(self.panel_2, wx.ID_ANY, "")
        self.label_satus = wx.StaticText(self.panel_2, wx.ID_ANY, _("Status"))
        self.text_ctrl_1 = wx.TextCtrl(self.panel_2, wx.ID_ANY, "", style=wx.TE_MULTILINE | wx.TE_READONLY | wx.HSCROLL | wx.NO_BORDER)
        self.button_finished = wx.Button(self.panel_2, wx.ID_ANY, _("Finished"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_TEXT_ENTER, self.on_password_enter, self.text_ctrl_passw)
        self.Bind(wx.EVT_BUTTON, self.on_next, self.button_next)
        self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_8)
        self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_9)
        self.Bind(wx.EVT_CHECKBOX, self.on_check, self.checkbox_10)
        self.Bind(wx.EVT_BUTTON, self.on_previous, self.button_next_copy_copy)
        self.Bind(wx.EVT_BUTTON, self.on_proceed, self.button_next_copy)
        self.Bind(wx.EVT_BUTTON, self.on_finished, self.button_finished)
        # end wxGlade
项目:pywatch    作者:jackburridge    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=u"List Frame", pos=wx.DefaultPosition,
                          size=wx.Size(500, 300), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHintsSz(wx.DefaultSize, wx.DefaultSize)

        sizer = wx.BoxSizer(wx.VERTICAL)

        gb_sizer = wx.GridBagSizer(5, 5)
        gb_sizer.SetFlexibleDirection(wx.BOTH)
        gb_sizer.SetNonFlexibleGrowMode(wx.FLEX_GROWMODE_SPECIFIED)

        list_boxChoices = []
        self.list_box = wx.ListBox(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, list_boxChoices, 0)
        gb_sizer.Add(self.list_box, wx.GBPosition(0, 0), wx.GBSpan(1, 2), wx.EXPAND, 0)

        combo_boxChoices = []
        self.combo_box = wx.ComboBox(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
                                     combo_boxChoices, 0)
        gb_sizer.Add(self.combo_box, wx.GBPosition(1, 0), wx.GBSpan(1, 2), wx.EXPAND, 0)

        choiceChoices = []
        self.choice = wx.Choice(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choiceChoices, 0)
        self.choice.SetSelection(0)
        gb_sizer.Add(self.choice, wx.GBPosition(2, 0), wx.GBSpan(1, 2), wx.EXPAND, 0)

        self.text_ctrl = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize,
                                     wx.TE_PROCESS_ENTER)
        gb_sizer.Add(self.text_ctrl, wx.GBPosition(3, 0), wx.GBSpan(1, 1), wx.EXPAND, 0)

        self.button = wx.Button(self, wx.ID_ANY, u"Add", wx.DefaultPosition, wx.DefaultSize, 0)
        gb_sizer.Add(self.button, wx.GBPosition(3, 1), wx.GBSpan(1, 1), wx.ALL, 0)

        gb_sizer.AddGrowableCol(0)
        gb_sizer.AddGrowableRow(0)

        sizer.Add(gb_sizer, 1, wx.EXPAND | wx.ALL, 5)

        self.SetSizer(sizer)
        self.Layout()

        self.Centre(wx.BOTH)

        # Connect Events
        self.button.Bind(wx.EVT_BUTTON, self.on_add)
        self.text_ctrl.Bind(wx.EVT_TEXT_ENTER, self.on_add)

        self.model = WatchableDict()
        self.model["list"] = []
        self.model["text"] = ""
        pywatch.wx.ValueChanger(self.text_ctrl, self.model, "text")
        pywatch.wx.ItemContainerItemWatcher(self.list_box, self.model, "list")
        pywatch.wx.ItemContainerItemWatcher(self.choice, self.model, "list")
        pywatch.wx.ItemContainerItemWatcher(self.combo_box, self.model, "list")

    # Virtual event handlers, overide them in your derived class
项目:PAWS    作者:Moonbase59    | 项目源码 | 文件源码
def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_TFRAME, name='TFrame', parent=prnt,
              pos=wx.Point(254, 241), size=wx.Size(829, 786),
              style=wx.DEFAULT_FRAME_STYLE, title=u'PAWS Terminal')
        self._init_utils()
        self.SetClientSize(wx.Size(821, 748))
        self.SetMenuBar(self.TMenuBar)
        self.SetAutoLayout(True)
        self.SetToolTipString('TFrame')
        self.SetMinSize(wx.Size(-1, 21))

        self.TStatusBar = wx.StatusBar(id=wxID_TFRAMETSTATUSBAR,
              name='TStatusBar', parent=self, style=0)
        self.TStatusBar.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              u'Courier New'))
        self._init_coll_TStatusBar_Fields(self.TStatusBar)
        self.SetStatusBar(self.TStatusBar)

        self.TInput = wx.TextCtrl(id=wxID_TFRAMETINPUT, name='TInput',
              parent=self, pos=wx.Point(1, 728), size=wx.Size(819, 20),
              style=wx.SIMPLE_BORDER | wx.TE_PROCESS_ENTER, value="''")
        self.TInput.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.BOLD, False,
              u'Courier'))
        self.TInput.SetToolTipString(u'Type command here.')
        self.TInput.SetAutoLayout(False)
        self.TInput.SetEditable(True)
        self.TInput.Enable(False)
        self.TInput.Bind(wx.EVT_TEXT_ENTER, self.OnTInputTextEnter,
              id=wxID_TFRAMETINPUT)

        self.TDisplay = wx.TextCtrl(id=wxID_TFRAMETDISPLAY, name='TDisplay',
              parent=self, pos=wx.Point(0, 0), size=wx.Size(821, 728),
              style=wx.TE_RICH2 | wx.TE_MULTILINE | wx.TE_READONLY,
              value=u'To run a game, choose File ? Pick Game … then choose a game from the list.')
        self.TDisplay.SetMinSize(wx.Size(517, 440))
        self.TDisplay.SetEditable(False)
        self.TDisplay.SetToolTipString(u"Game's output displays here.")
        self.TDisplay.SetFont(wx.Font(12, wx.SWISS, wx.NORMAL, wx.NORMAL, False,
              u'Arial'))
        self.TDisplay.Enable(True)

        self._init_sizers()