Python wx 模块,EVT_KEY_UP 实例源码

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

项目:bonsu    作者:bonsudev    | 项目源码 | 文件源码
def BindEvents(self):
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None)
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnButtonDown)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnButtonDown)
        self.Bind(wx.EVT_MIDDLE_DOWN, self.OnButtonDown)
        self.Bind(wx.EVT_RIGHT_UP, self.OnButtonUp)
        self.Bind(wx.EVT_LEFT_UP, self.OnButtonUp)
        self.Bind(wx.EVT_MIDDLE_UP, self.OnButtonUp)
        self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
        self.Bind(wx.EVT_MOTION, self.OnMotion)
        self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
        self.Bind(wx.EVT_CHAR, self.OnKeyDown)
        self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
        if wx.Platform == "__WXGTK__":
            # wxGTK requires that the window be created before you can
            # set its shape, so delay the call to SetWindowShape until
            # this event.
            self.Bind(wx.EVT_WINDOW_CREATE, self.OnWindowCreate)
        else:
            # On wxMSW and wxMac the window has already been created.
            self.Bind(wx.EVT_SIZE, self.OnSize)
        if _useCapture and hasattr(wx, 'EVT_MOUSE_CAPTURE_LOST'):
            self.Bind(wx.EVT_MOUSE_CAPTURE_LOST, self.OnMouseCaptureLost)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def __init__(self, parent, name, mgr, *args, **kwargs):
        """Construct a new page.

        Args:
            name:           The string name of this page as it will appear
                            to the user.

            mgr:            The cebl.manager.Manager instance that manages
                            all sources and pages.

            args, kwargs:   Additional arguments to pass to wx.Panel.
        """
        wx.Panel.__init__(self, parent=parent, *args, **kwargs)

        self.name = name
        self.running = False

        self.mgr = mgr
        self.src = self.mgr.getSource()

        self.Bind(wx.EVT_KEY_UP, self.onKeyUp)
项目: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
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def add_num(self, rang, accu, title, key, unit):
        sizer = wx.BoxSizer( wx.HORIZONTAL )
        lab_title = wx.StaticText( self, wx.ID_ANY, title,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_title.Wrap( -1 )
        sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        ctrl = NumCtrl(self, rang, accu)
        self.ctrl_dic[key] = ctrl
        ctrl.Bind(wx.EVT_KEY_UP, lambda x : self.para_changed(key))
        sizer.Add( ctrl, 2, wx.ALL, 5 )

        lab_unit = wx.StaticText( self, wx.ID_ANY, unit,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_unit.Wrap( -1 )
        sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        self.tus.append((lab_title, lab_unit))
        self.lst.Add( sizer, 0, wx.EXPAND, 5 )
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def add_color(self, title, key, unit):
        sizer = wx.BoxSizer( wx.HORIZONTAL )
        lab_title = wx.StaticText( self, wx.ID_ANY, title,
                                   wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_title.Wrap( -1 )
        sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        ctrl = ColorCtrl(self)
        self.ctrl_dic[key] = ctrl
        ctrl.Bind(wx.EVT_KEY_UP, lambda x : self.para_changed(key))
        sizer.Add( ctrl, 2, wx.ALL, 5 )

        lab_unit = wx.StaticText( self, wx.ID_ANY, unit,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_unit.Wrap( -1 )
        sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        self.tus.append((lab_title, lab_unit))
        self.lst.Add( sizer, 0, wx.EXPAND, 5 )
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def add_txt(self, title, key, unit):
        sizer = wx.BoxSizer( wx.HORIZONTAL )
        lab_title = wx.StaticText( self, wx.ID_ANY, title,
                                   wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_title.Wrap( -1 )
        sizer.Add( lab_title, 0, wx.ALIGN_CENTER|wx.ALL, 5 )

        ctrl = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString,
                            wx.DefaultPosition, wx.DefaultSize, 0 )

        self.ctrl_dic[key] = ctrl
        ctrl.Bind( wx.EVT_KEY_UP, lambda x : self.para_changed(key))
        sizer.Add( ctrl, 2, wx.ALL, 5 )

        lab_unit = wx.StaticText( self, wx.ID_ANY, unit,
                                  wx.DefaultPosition, wx.DefaultSize, wx.ALIGN_CENTRE )

        lab_unit.Wrap( -1 )
        sizer.Add( lab_unit, 0, wx.ALIGN_CENTER|wx.ALL, 5 )
        self.tus.append((lab_title, lab_unit))
        self.lst.Add( sizer, 0, wx.EXPAND, 5 )
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def bindKeyboard(self):
        self.Bind(wx.EVT_KEY_DOWN, self.onKeyPress)    
        self.Bind(wx.EVT_KEY_UP, self.onKeyRelease)
项目:cebl    作者:idfah    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        wx.Frame.__init__(self, *args, **kwargs)
        #self.Bind(wx.EVT_KEY_UP, self.onKeyUp)
        self.Bind(events.EVT_FULLSCREEN, self.toggleFullScreen)

    #def onKeyUp(self, event):
    #    key = event.GetKeyCode()
    #    if key == wx.WXK_F11:
    #        wx.PostEvent(self, events.FullScreenEvent(id=wx.ID_ANY))
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def __init__(self, parent, rang, accury):
        wx.TextCtrl.__init__(self, parent, wx.TE_RIGHT)
        self.min, self.max = rang
        self.accury = accury
        wx.TextCtrl.Bind(self, wx.EVT_KEY_UP, self.ontext)

    #! TODO: what is this?
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def __init__(self, parent):
        wx.TextCtrl.__init__(self, parent, wx.TE_RIGHT)
        wx.TextCtrl.Bind(self, wx.EVT_KEY_UP, self.ontext)
        wx.TextCtrl.Bind(self, wx.EVT_LEFT_DOWN, self.oncolor)
项目:BigBrotherBot-For-UrT43    作者:ptitbigorneau    | 项目源码 | 文件源码
def __init__( 
        self,  parent=None, id=-1, pos=wx.DefaultPosition, 
        size=wx.DefaultSize, 
        style=wx.TAB_TRAVERSAL|wx.NO_BORDER|wx.FULL_REPAINT_ON_RESIZE, 
        name='SquareMap', model = None,
        adapter = None,
        labels = True, # set to True to draw textual labels within the boxes
        highlight = True, # set to False to turn of highlighting
        padding = 2, # amount to reduce the children's box from the parent's box
    ):
        super( SquareMap, self ).__init__(
            parent, id, pos, size, style, name
        )
        self.model = model
        self.padding = padding
        self.labels = labels
        self.highlight = highlight
        self.selectedNode = None
        self.highlightedNode = None
        self.Bind( wx.EVT_PAINT, self.OnPaint)
        self.Bind( wx.EVT_SIZE, self.OnSize )
        if highlight:
            self.Bind( wx.EVT_MOTION, self.OnMouse )
        self.Bind( wx.EVT_LEFT_UP, self.OnClickRelease )
        self.Bind( wx.EVT_LEFT_DCLICK, self.OnDoubleClick )
        self.Bind( wx.EVT_KEY_UP, self.OnKeyUp )
        self.hot_map = []
        self.adapter = adapter or DefaultAdapter()
        self.DEFAULT_PEN = wx.Pen( wx.BLACK, 1, wx.SOLID )
        self.SELECTED_PEN = wx.Pen( wx.WHITE, 2, wx.SOLID )
        self.OnSize(None)
项目: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)
项目: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()
项目:squaremap3    作者:kawaiicthulhu    | 项目源码 | 文件源码
def __init__(
        self,  parent=None, id=-1, pos=wx.DefaultPosition,
        size=wx.DefaultSize,
        style=wx.TAB_TRAVERSAL|wx.NO_BORDER|wx.FULL_REPAINT_ON_RESIZE,
        name='SquareMap', model = None,
        adapter = None,
        labels = True, 
        highlight = True,
        padding = 2,
        margin = 0,
        square_style = False,
    ):
        """Initialise the SquareMap

        adapter -- a DefaultAdapter or same-interface instance providing SquareMap data api
        labels -- set to True (default) to draw textual labels within the boxes
        highlight -- set to True (default) to highlight nodes on mouse-over 
        padding -- spacing within each square and its children (within the square's border)
        margin -- spacing around each square (on all sides)
        square_style -- use a more-recursive, less-linear, more "square" layout style which 
            works better on objects with large numbers of children, such as Meliae memory 
            dumps, works fine on profile views as well, but the layout is less obvious wrt 
            what node is "next" "previous" etc.
        """
        super( SquareMap, self ).__init__(
            parent, id, pos, size, style, name
        )
        self.model = model
        self.padding = padding
        self.square_style = square_style
        self.margin = margin
        self.labels = labels
        self.highlight = highlight
        self.selectedNode = None
        self.highlightedNode = None
        self._buffer = wx.Bitmap(20, 20) # Have a default buffer ready
        self.Bind( wx.EVT_PAINT, self.OnPaint)
        self.Bind( wx.EVT_SIZE, self.OnSize )
        if highlight:
            self.Bind( wx.EVT_MOTION, self.OnMouse )
        self.Bind( wx.EVT_LEFT_UP, self.OnClickRelease )
        self.Bind( wx.EVT_LEFT_DCLICK, self.OnDoubleClick )
        self.Bind( wx.EVT_KEY_UP, self.OnKeyUp )
        self.hot_map = []
        self.adapter = adapter or DefaultAdapter()
        self.DEFAULT_PEN = wx.Pen( wx.BLACK, 1, wx.SOLID )
        self.SELECTED_PEN = wx.Pen( wx.WHITE, 2, wx.SOLID )
        self.OnSize(None)