Python wx 模块,EVT_KEY_DOWN 实例源码

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

项目:laplacian-meshes    作者:bmershon    | 项目源码 | 文件源码
def __init__(self, parent):
        super(MeshViewerCanvas, self).__init__(parent)
        self.GUIState = STATE_NORMAL
        self.GUISubstate = SUBSTATE_NONE

        self.clearAllSelections()

        #State variables for heat, etc
        (self.eigvalues, self.eigvectors) = (np.array([]), np.array([]))
        self.heatIdx = 0
        self.heat_ts = np.linspace(0, 1000, 100)

        #State variables for color picking
        self.colorPickTexID = None
        self.colorPosVBO = None
        self.colorColorVBO = None

        self.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)
        self.Bind(wx.EVT_KEY_UP, self.onKeyRelease)
        self.pressingC = False
项目:python_2048    作者:OATOMO    | 项目源码 | 文件源码
def __init__(self,title):
        super(Frame,self).__init__(None,-1,title,style=wx.DEFAULT_FRAME_STYLE^wx.MAXIMIZE_BOX^wx.RESIZE_BORDER)
        self.colors = {0:(204,192,179),2:(238, 228, 218),4:(237, 224, 200),8:(242, 177, 121),16:(245, 149, 99),32:(246, 124, 95),64:(246, 94, 59),128:(237, 207, 114),256:(237, 207, 114),512:(237, 207, 114),1024:(237, 207, 114),2048:(237, 207, 114),4096:(237, 207, 114),8192:(237, 207, 114),16384:(237, 207, 114),32768:(237, 207, 114),65536:(237, 207, 114),131072:(237, 207, 114),262144:(237, 207, 114),524288:(237, 207, 114),1048576:(237, 207, 114),2097152:(237, 207, 114),4194304:(237, 207, 114),8388608:(237, 207, 114),16777216:(237, 207, 114)}#?????????

        self.setIcon()
        self.initGame()
        self.initBuffer()

        panel = wx.Panel(self)  #??????
        #------????
        panel.Bind(wx.EVT_KEY_DOWN,self.onKeyDown)
        panel.SetFocus() #?????
        self.Bind(wx.EVT_SIZE,self.onSize) #use wx.BufferedPaintDC
        self.Bind(wx.EVT_PAINT,self.onPaint)
        self.Bind(wx.EVT_CLOSE,self.onClose) #????
        #------

        self.SetClientSize((505,720)) #??????
        self.Center() #?????
        self.Show()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        wx.gizmos.EditableListBox.__init__(self, *args, **kwargs)

        listbox = self.GetListCtrl()
        listbox.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
        listbox.Bind(wx.EVT_LIST_BEGIN_LABEL_EDIT, self.OnLabelBeginEdit)
        listbox.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnLabelEndEdit)

        for button, tooltip, call_function in [
                (self.GetEditButton(), _("Edit item"), "_OnEditButton"),
                (self.GetNewButton(), _("New item"), "_OnNewButton"),
                (self.GetDelButton(), _("Delete item"), "_OnDelButton"),
                (self.GetUpButton(), _("Move up"), "_OnUpButton"),
                (self.GetDownButton(), _("Move down"), "_OnDownButton")]:
            button.SetToolTipString(tooltip)
            button.Bind(wx.EVT_BUTTON, self.GetButtonPressedFunction(call_function))

        self.Editing = False
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Control.__init__(self, parent)

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

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

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

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

        self.SetSizer(main_sizer)

        self.Controller = None
        self.VarType = None
        self.Default = False
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Control.__init__(self, parent)

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

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

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

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

        self.SetSizer(main_sizer)

        self.Default = None
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: sms_dialoge.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER | wx.MAXIMIZE_BOX | wx.THICK_FRAME
        wx.Frame.__init__(self, *args, **kwds)
        self.panel_5 = wx.Panel(self, wx.ID_ANY)
        self.label_7 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Username"))
        self.combo_box_1 = wx.ComboBox(self.panel_5, wx.ID_ANY, choices=[("Select"), ("admin"), ("teacher")], style=wx.CB_READONLY|wx.CB_DROPDOWN)
        self.label_8 = wx.StaticText(self.panel_5, wx.ID_ANY, ("Password"))
        self.text_ctrl_1 = wx.TextCtrl(self.panel_5, wx.ID_ANY, "", style=wx.TE_PASSWORD)
        self.button_1 = wx.Button(self.panel_5, wx.ID_ANY, ("Cancel"))
        self.button_2 = wx.Button(self.panel_5, wx.ID_ANY, ("Login"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.on_user, self.combo_box_1)
        self.Bind(wx.EVT_TEXT, self.on_text, self.text_ctrl_1)
        self.Bind(wx.EVT_BUTTON, self.on_cancel, self.button_1)
        self.Bind(wx.EVT_BUTTON, self.on_login, self.button_2)

        self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress)
        self.Bind(wx.EVT_CLOSE,self.on_close,self)
        self.UO=user_operations(self)
        # end wxGlade
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: add_academic_year.__init__
        kwds["style"] = wx.DEFAULT_DIALOG_STYLE
        wx.Dialog.__init__(self, *args, **kwds)
        self.label_3 = wx.StaticText(self, wx.ID_ANY, ("Academic Year"))
        self.text_ctrl_1 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.label_4 = wx.StaticText(self, wx.ID_ANY, ("-"))
        self.text_ctrl_2 = wx.TextCtrl(self, wx.ID_ANY, "")
        self.button_close = wx.Button(self, wx.ID_ANY, ("Close"))
        self.button_add = wx.Button(self, wx.ID_ANY, ("Add"))

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_TEXT, self.on_enter, self.text_ctrl_1)

        self.Bind(wx.EVT_BUTTON, self.on_close, self.button_close)
        self.Bind(wx.EVT_BUTTON, self.on_add, self.button_add)

        self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.handle_keypress)

        self.NEW_YEAR=''
        # end wxGlade
项目:stopgo    作者:notklaatu    | 项目源码 | 文件源码
def BindKeys(self,dbfile):
        '''
        Bind keyboard shortcuts for application.
        '''
        self.Bind(wx.EVT_MENU, lambda event, args=('MENU_DEL',dbfile): self.OnKeyDown(event,args), self.ditem)
        self.Bind(wx.EVT_MENU, lambda event, args=dbfile: self.Undo(event,args), self.zitem)
        self.Bind(wx.EVT_BUTTON, lambda event, args=('wx.WXK_SPACE',dbfile): self.OnKeyDown(event,args), self.bplay)
        self.Bind(wx.EVT_BUTTON, lambda event, args=(dbfile): self.CaptureCanvas(event,args), self.brec)

        self.panel3.Bind(wx.EVT_KEY_DOWN, lambda event, args=(dbfile): self.OnKeyDown(event, args))
        self.panel3.Bind(wx.EVT_LEFT_DOWN, self.OnMouseClick)
        self.Bind(wx.EVT_MENU, lambda event, args=(dbfile):self.OnQuit(event,args), self.qitem)
        self.Bind(wx.EVT_CLOSE, lambda event, args=(dbfile):self.OnQuit(event,args), self.qitem)
        self.Bind(wx.EVT_MENU, lambda event, args=(dbfile):self.OnRender(event,args), self.ritem)
项目:MaTags    作者:hastelloy    | 项目源码 | 文件源码
def __init__(self, parent, title):
        style = wx.DEFAULT_FRAME_STYLE & ~(
            wx.RESIZE_BORDER | wx.MAXIMIZE_BOX |
            wx.MINIMIZE_BOX|wx.CLOSE_BOX)

        wx.Frame.__init__(self, parent, title=title, 
            style=style, size=(400,60))
        self.textbox = wx.TextCtrl(self)

        img = wx.Image("matags.png", wx.BITMAP_TYPE_ANY)
        bmp = wx.Bitmap(img)
        self.icon = wx.Icon()
        self.icon.CopyFromBitmap(bmp)
        self.SetIcon(self.icon)

        self.tbIcon = wx.adv.TaskBarIcon()
        self.tbIcon.SetIcon(self.icon)

        self.Show(True)
        self.Centre()

        self.reg_hot_keys()        
        self.Bind(wx.EVT_HOTKEY, self.on_extract_tag, 
            id=self.hotkeys['extract_tag'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_close, 
            id=self.hotkeys['quit'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_activate, 
            id=self.hotkeys['activate'][0])
        self.Bind(wx.EVT_HOTKEY, self.on_refresh, 
            id=self.hotkeys['refresh'][0])
        self.textbox.Bind(wx.EVT_CHAR, self.check_key)
        # do not use EVT_KEY_DOWN, 
        # it becomes difficult to get lower case
        # self.textbox.Bind(wx.EVT_KEY_DOWN, self.check_key)
        # self.Bind(wx.EVT_CLOSE, self.on_close)
        self.Bind(wx.EVT_ICONIZE, self.on_iconify)
        self.matags = MaTags()
        # try:
        # except Exception as e:
        #     self.textbox.ChangeValue(e.args[0].decode('utf8', 'ignore'))
        #     self.textbox.Disable()
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def bindKeyboard(self):
        self.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)    
        self.Bind(wx.EVT_KEY_UP, self.onKeyRelease)
项目:driveboardapp    作者:nortd    | 项目源码 | 文件源码
def main():

    def onKeyDown(event):
        if event.GetKeyCode() == wx.WXK_ESCAPE:
            frame.Close()

    app = wx.App(0)
    frame = wx.Frame(None, title="Hello World from wxPython")
    panel = wx.Panel(frame)
    label = wx.StaticText(panel, -1,
                          u"Press <ESC> to exit. Some non-ascii chars: ??š?íá?")
    panel.Bind(wx.EVT_KEY_DOWN, onKeyDown)
    panel.SetFocus()
    frame.Show()
    app.MainLoop()
项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.Panel.__init__(self, parent)
        self.intro = "Interactive Phase Retrieval Suite"
        self.shell = Shell(parent = self, id = wx.ID_ANY, introText=self.intro)
        self.shell.zoom(2)
        self.shell.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown, self.shell)
        self.ih = 0
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.shell, 1, flag = wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=2)
        sizer.Fit(self)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        self.Layout()
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def ShowInstanceChoicePopup(self):
        self.InstanceChoice.SetFocusFromKbd()
        size = self.InstanceChoice.GetSize()
        event = wx.MouseEvent(wx.EVT_LEFT_DOWN._getEvtType())
        event.x = size.width / 2
        event.y = size.height / 2
        event.SetEventObject(self.InstanceChoice)
        # event = wx.KeyEvent(wx.EVT_KEY_DOWN._getEvtType())
        # event.m_keyCode = wx.WXK_SPACE
        self.InstanceChoice.GetEventHandler().ProcessEvent(event)
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: Login.__init__
        kwds["style"] = wx.ICONIZE | wx.CAPTION | wx.MINIMIZE | wx.CLOSE_BOX | wx.MINIMIZE_BOX
        wx.Frame.__init__(self, *args, **kwds)
        self.label_1 = wx.StaticText(self, -1, "Username")
        self.combo_box_1 = wx.ComboBox(self, -1, choices=["Select", "admin", "teacher"], style=wx.CB_DROPDOWN)
        self.label_2 = wx.StaticText(self, -1, "Password")
        self.text_ctrl_1 = wx.TextCtrl(self, -1, "", style=wx.TE_PROCESS_TAB | wx.TE_PASSWORD)
        self.button_1 = wx.Button(self, -1, "Cancel")
        self.button_2 = wx.Button(self, -1, "Login")

        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.OnCombo_Change, self.combo_box_1)
        self.Bind(wx.EVT_BUTTON, self.OnCancel_Click, self.button_1)
        self.Bind(wx.EVT_BUTTON, self.OnLogin_Click, self.button_2)  

        self.Bind(wx.EVT_TEXT,self.OnText_Change,self.text_ctrl_1)

        #self.Bind(wx.EVT_KEY_DOWN,self.OnKeyPress,self.text_ctrl_1)
        self.Bind(wx.EVT_CLOSE,self.on_close,self)
        self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress)
        self.UO=user_operations(self)
        # DB Connection obj



        # end wxGlade
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title="Key Press Tutorial")

        panel = wx.Panel(self, wx.ID_ANY)
        btn = wx.Button(panel, label="OK")

        btn.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self):
        wx.Frame.__init__(self, None, title="Key Press Tutorial 2")

        panel = wx.Panel(self, wx.ID_ANY)
        sizer = wx.BoxSizer(wx.VERTICAL)

        btn = self.onWidgetSetup(wx.Button(panel, label="OK"), 
                                 wx.EVT_KEY_UP,
                                 self.onButtonKeyEvent, sizer)
        txt = self.onWidgetSetup(wx.TextCtrl(panel, value=""),
                                 wx.EVT_KEY_DOWN, self.onTextKeyEvent,
                                 sizer)
        panel.SetSizer(sizer)
项目:wxpythoncookbookcode    作者:driscollis    | 项目源码 | 文件源码
def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        self.Bind(wx.EVT_KEY_DOWN, self.onKey)
项目:mac-package-build    作者:persepolisdm    | 项目源码 | 文件源码
def main():

    def onKeyDown(event):
        if event.GetKeyCode() == wx.WXK_ESCAPE:
            frame.Close()

    app = wx.App(0)
    frame = wx.Frame(None, title="Hello World from wxPython")
    panel = wx.Panel(frame)
    label = wx.StaticText(panel, -1,
                          u"Press <ESC> to exit. Some non-ascii chars: ??š?íá?")
    panel.Bind(wx.EVT_KEY_DOWN, onKeyDown)
    panel.SetFocus()
    frame.Show()
    app.MainLoop()
项目:padherder_proxy    作者:jgoldshlag    | 项目源码 | 文件源码
def __init__(self, parent, main_tab):
        wx.Panel.__init__(self, parent)
        self.Bind(custom_events.EVT_MAIL_EVENT, self.onMailEvent)
        self.grid = wx.grid.Grid(self, wx.ID_ANY, size=(-1,-1))
        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.grid, 0, wx.EXPAND)
        self.SetSizer(self.sizer)
        self.SetAutoLayout(1)
        self.sizer.Fit(self)
        self.main_tab = main_tab
        self.grid.Bind(wx.EVT_KEY_DOWN, self.onKeyDown)
项目:SpatialTool    作者:JRcard    | 项目源码 | 文件源码
def __init__(self, parent, pos=(0,0), size=(100,100), numSpeakers=2):
        wx.Panel.__init__(self, parent, pos=pos, size=size)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)

        self.audio = vars.getVars("Audio")
        self.pos = None
        self.size = size
        self.currentCircle = None
        self.currentSpeaker = None
        self.isAList = False
        self.catch = False
        self.catchSpeaker = False
        self.shift = False
        self.alt = False
        self.s = False
        self.numSpeakers = numSpeakers # FL 29/05/17

        #OSC Variables
        self.incs = [0, 0, 0, 0]
        self.absPos = [0, 0, 0, 0] # FL 04/09/2017
        self.mode2 = False # FL 04/09/2017

        # Creation des cercles/sources
        self.blueCircle = Source(self.size[0]*BLUE_START[0], self.size[1]*BLUE_START[1], CIRCLE_RADIUS) 
        self.redCircle = Source(self.size[0]*RED_START[0], self.size[1]*RED_START[1], CIRCLE_RADIUS)


        speakers = []
        for i in range(self.numSpeakers):
            setup = vars.getVars("Speakers_setup")
            x, y = self.size[0]*setup[i][0], self.size[1]*setup[i][1] #FL 02/09/2017
            speakers.append(Speaker(x, y, SPEAKER_RADIUS))
        vars.setVars("Speakers", speakers)

#        print vars.getVars("Speakers")[0].c
        self.speakerAdjusted() # FL 29/05/17

        # méthode pour les controles
        self.Bind(wx.EVT_PAINT, self.onPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.onLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.onLeftUp)
        self.Bind(wx.EVT_RIGHT_DOWN, self.onRightDown)
        self.Bind(wx.EVT_MOTION, self.onMotion)

        self.Bind(wx.EVT_KEY_DOWN, self.onKeyDown)
        self.Bind(wx.EVT_KEY_UP, self.onKeyUp)

        self.on_timer()
项目: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)
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def __init__(self, *args, **kwds):
        # begin wxGlade: add_div.__init__

        kwds["style"] = wx.CAPTION | wx.CLOSE_BOX | wx.MINIMIZE_BOX | wx.STAY_ON_TOP
        wx.Dialog.__init__(self, *args, **kwds)
        self.panel_1 = wx.ScrolledWindow(self, -1, style=wx.TAB_TRAVERSAL)
        self.label_1 = wx.StaticText(self.panel_1, -1, "YEAR")


        self.combo_box_1 = wx.ComboBox(self.panel_1, -1, choices=[], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN | wx.CB_READONLY | wx.CB_SORT)
        self.label_2 = wx.StaticText(self.panel_1, -1, "CLASS")
        self.combo_box_2 = wx.ComboBox(self.panel_1, -1, choices=["Select","8","9","10"], style=wx.CB_DROPDOWN | wx.CB_DROPDOWN | wx.CB_READONLY | wx.CB_SORT)
        self.sizer_4_staticbox = wx.StaticBox(self.panel_1, -1, "Specify Class ")
        self.list_box_1 = wx.ListBox(self.panel_1, -1, choices=[], style=wx.LB_SINGLE | wx.LB_SORT)
        self.button_1 = wx.Button(self.panel_1, -1, "Remove Divison")
        self.text_ctrl_1 = wx.TextCtrl(self.panel_1, -1, "")
        self.button_2 = wx.Button(self.panel_1, -1, "Add Division")
        self.sizer_9_staticbox = wx.StaticBox(self.panel_1, -1, "New Division")
        self.button_3 = wx.Button(self.panel_1, -1, "Close")
        self.hyperlink_1 = wx.HyperlinkCtrl(self.panel_1, wx.ID_ANY, "", "Add Academic Year")


        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_COMBOBOX, self.on_year, self.combo_box_1)
        self.Bind(wx.EVT_COMBOBOX, self.on_class, self.combo_box_2)
        self.Bind(wx.EVT_LISTBOX, self.on_list, self.list_box_1)
        self.Bind(wx.EVT_BUTTON, self.on_remove, self.button_1)
        self.Bind(wx.EVT_TEXT, self.on_text, self.text_ctrl_1)

        self.Bind(wx.EVT_BUTTON, self.on_add, self.button_2)
        self.Bind(wx.EVT_BUTTON, self.on_close, self.button_3)

        self.text_ctrl_1 .Bind(wx.EVT_SET_FOCUS,self.onfocus)
        self.text_ctrl_1 .Bind(wx.EVT_KILL_FOCUS,self.offocus)
        self.text_ctrl_1.Bind(wx.EVT_KEY_DOWN, self.on_keypress)

        self.Bind(wx.EVT_HYPERLINK, self.on_hlink, self.hyperlink_1)

        self.YEAR=''
        self.CLASS=''

        self.DB=db_operations()
        self.load_year()

        # end wxGlade
项目:beremiz    作者:nucleron    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        wx.grid.Grid.__init__(self, *args, **kwargs)

        self.Editable = True

        self.AddButton = None
        self.DeleteButton = None
        self.UpButton = None
        self.DownButton = None

        self.SetFont(wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans'))
        self.SetLabelFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, 'Sans'))
        self.SetSelectionBackground(wx.WHITE)
        self.SetSelectionForeground(wx.BLACK)
        self.DisableDragRowSize()

        self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSelectCell)
        self.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.OnEditorHidden)
        self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)