python类EVT_LEFT_DOWN的实例源码

render.py 文件源码 项目:bonsu 作者: bonsudev 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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)
dfgui.py 文件源码 项目:PandasDataFrameGUI 作者: bluenote10 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent, size, data, *args, **kwargs):

        wx.ListBox.__init__(self, parent, size, **kwargs)

        self.data = data

        self.InsertItems(data, 0)

        self.Bind(wx.EVT_LISTBOX, self.on_selection_changed)

        self.Bind(wx.EVT_LEFT_DOWN, self.on_left_down)

        self.Bind(wx.EVT_RIGHT_DOWN, self.on_right_down)
        self.Bind(wx.EVT_RIGHT_UP, self.on_right_up)
        self.Bind(wx.EVT_MOTION, self.on_move)

        self.index_iter = range(len(self.data))

        self.selected_items = [True] * len(self.data)
        self.index_mapping = list(range(len(self.data)))

        self.drag_start_index = None

        self.update_selection()
        self.SetFocus()
FancyTabNotebook.py 文件源码 项目:fmc-dialer 作者: sguron 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def OnMouseLeftDown(self, event):
        """
        Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`ImageContainerBase`.

        :param `event`: a :class:`MouseEvent` event to be processed.
        """

        newSelection = -1
        event.Skip()

        # Support for collapse/expand
        style = self.GetParent().GetAGWWindowStyleFlag()

        tabIdx, where = self.HitTest(event.GetPosition())

        if where == IMG_OVER_IMG:
            self._nHoveredImgIdx = -1

        if tabIdx == -1:
            return

        self.GetParent().SetSelection(tabIdx)
UI.py 文件源码 项目:AppAutoViewer 作者: RealLau 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """Constructor"""
        self.notUseDetaul = None
        wx.Panel.__init__(self, parent=parent, size = (500,800))
        B = wx.StaticBox(self, -1)
        BSizer = wx.StaticBoxSizer(B, wx.VERTICAL)
        self.imagesDir = os.path.join(".", "images")
        self.screenShotDir = os.path.join(".", "screenShot")
        self.defaultScreenShotImage = wx.Image(os.path.join(self.imagesDir, "default.png"), wx.BITMAP_TYPE_PNG).ConvertToBitmap()
        self.screenShot = wx.StaticBitmap(self,-1, self.defaultScreenShotImage)
        self.screenShot.Bind(wx.EVT_LEFT_DOWN, self.DrawOrReloadAll)
        self.statusBar = wx.StaticText(self, -1, "")
        BSizer.Add(self.statusBar)
        BSizer.Add(self.screenShot,5,wx.EXPAND, 5)
        self.SetSizer(BSizer)
        pub.subscribe(self.updateStatus, "update")
        pub.subscribe(self.DrawFromSelectedNode, "DrawFromSelectedNode")
        pub.subscribe(self.DoSwipeOrInput, "DoSwipeOrInput")
        self.hasDrew = False
canvas3d.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, parent, manager=None):
        attribList = attribs = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24)
        glcanvas.GLCanvas.__init__(self, parent, -1, attribList=attribList)
        self.init = False
        self.context = glcanvas.GLContext(self)
        self.manager = self.manager = Manager() if manager is None else manager
        self.size = None

        self.SetBackgroundStyle(wx.BG_STYLE_PAINT)

        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
        self.Bind(wx.EVT_MOTION, self.OnMouseMotion)
        self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
        self.lastx, self.lasty = None, None
        self.update = True
        #print('init===========')
toolsloader.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def buildToolsBar(parent, datas):    
    box = wx.BoxSizer( wx.HORIZONTAL )
    #toolsbar =  wx.ToolBar( parent, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TB_HORIZONTAL ) 
    toolsbar = wx.Panel( parent, wx.ID_ANY, 
                         wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL )

    toolsbar.SetSizer( box )
    add_tools(toolsbar, datas[1][0][1], None)

    gifpath = os.path.join(root_dir, "tools/drop.gif")
    btn = wx.BitmapButton(toolsbar, wx.ID_ANY, make_bitmap(wx.Bitmap(gifpath)),
                          wx.DefaultPosition, (32, 32), wx.BU_AUTODRAW|wx.RAISED_BORDER)

    box.Add(btn)
    btn.Bind(wx.EVT_LEFT_DOWN, lambda x:menu_drop(parent, toolsbar, datas, btn, x))
    add_tools(toolsbar, datas[1][1][1])
    return toolsbar
frame_nav.py 文件源码 项目:GRIPy 作者: giruenf 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def set_selrange(self, sel=True, selmin=None, selmax=None):
        if sel:
            self.SetWindowStyle(wx.SL_SELRANGE)
            if selmin is None or selmax is None:
                raise Exception()
            else:
                self.SetSelection(selmin, selmax)
            self.Bind(wx.EVT_LEFT_DOWN, self.on_event)  
        else:
            self.ClearSel()
            if self.is_selrange():
                self.Unbind(wx.EVT_LEFT_DOWN, handler=self.on_event)
            self.SetWindowStyle(wx.SL_BOTTOM)       
            if selmin is None:
                raise Exception()
            super(RangeSlider, self).SetValue(selmin)
wxPython_Wallpaper.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)        
        self.context = glcanvas.GLContext(self)
        self.init = False

        # Cube 3D start rotation
        self.last_X = self.x = 30
        self.last_Y = self.y = 30

        self.Bind(wx.EVT_SIZE, self.sizeCallback)
        self.Bind(wx.EVT_PAINT, self.paintCallback)
        self.Bind(wx.EVT_LEFT_DOWN, self.mouseDownCallback)
        self.Bind(wx.EVT_LEFT_UP, self.mouseUpCallback)
        self.Bind(wx.EVT_MOTION, self.mouseMotionCallback)
wxPython_OpenGL_GUI.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)        
        self.context = glcanvas.GLContext(self)
        self.init = False

        # Cube 3D start rotation
        self.last_X = self.x = 30
        self.last_Y = self.y = 30

        self.Bind(wx.EVT_SIZE, self.sizeCallback)
        self.Bind(wx.EVT_PAINT, self.paintCallback)
        self.Bind(wx.EVT_LEFT_DOWN, self.mouseDownCallback)
        self.Bind(wx.EVT_LEFT_UP, self.mouseUpCallback)
        self.Bind(wx.EVT_MOTION, self.mouseMotionCallback)
import_OpenGL_cube_and_cone.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)
        self.init = False
        self.context = glcanvas.GLContext(self)         # <== this was missing when I wrote the book in 2015...

        # initial mouse position
        self.lastx = self.x = 30
        self.lasty = self.y = 30
        self.size = None
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
        self.Bind(wx.EVT_MOTION, self.OnMouseMotion)
wxPython_Wallpaper_simple.py 文件源码 项目:Python-GUI-Programming-Cookbook-Second-Edition 作者: PacktPublishing 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        glcanvas.GLCanvas.__init__(self, parent, -1)        
        self.context = glcanvas.GLContext(self)
        self.init = False

        # Cube 3D start rotation
        self.last_X = self.x = 30
        self.last_Y = self.y = 30

        self.Bind(wx.EVT_SIZE, self.sizeCallback)
        self.Bind(wx.EVT_PAINT, self.paintCallback)
        self.Bind(wx.EVT_LEFT_DOWN, self.mouseDownCallback)
        self.Bind(wx.EVT_LEFT_UP, self.mouseUpCallback)
        self.Bind(wx.EVT_MOTION, self.mouseMotionCallback)
SndView.py 文件源码 项目:SpatialTool 作者: JRcard 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, obj=None, mouse_callback=None, select_callback=None):
        wx.Panel.__init__(self, parent)
        self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
        self.Bind(wx.EVT_RIGHT_UP, self.OnMouseUp)
        self.Bind(wx.EVT_MOTION, self.OnMotion)
        self.Bind(wx.EVT_SIZE, self.OnSize)
        self.refresh_from_selection = False
        self.background_bitmap = None
        self.obj = obj
        self.selstart = self.selend = self.movepos = None
        self.moveSelection = False
        self.createSelection = False
        self.begin = 0
        if self.obj is not None:
            self.chnls = len(self.obj)
            self.end = self.obj.getDur(False)
        else:
            self.chnls = 1
            self.end = 1.0
        self.img = [[]]
        self.mouse_callback = mouse_callback
        self.select_callback = select_callback
        if sys.platform == "win32" or sys.platform.startswith("linux"):
            self.dcref = wx.BufferedPaintDC
        else:
            self.dcref = wx.PaintDC
        self.setImage()
        #FL 02/10/2017
        self.playCursorPos = 0
gui.py 文件源码 项目:stopgo 作者: notklaatu 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
gui.py 文件源码 项目:stopgo 作者: notklaatu 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def BuildTimeline(self,dbfile):

        for child in self.panel3.GetChildren():
            logging.exception(child)
            child.Destroy()

        # the last frame is
        latestfram = self.cur.execute("SELECT * FROM Timeline ORDER BY Image DESC LIMIT 1")
        #latestfram = self.cur.execute("SELECT * FROM Timeline WHERE ID = (SELECT MAX(ID) FROM TABLE) AND Blackspot = 0");
        try:
            for entry in latestfram:
                self.framlog = int(entry[1].split('.')[0])
                self.framlog += 1
                logging.exception(self.framlog)
        except:
            logging.exception('Looking for last frame but did not find.')
            pass

        # timeline contains
        tbl_timeline = self.cur.execute("SELECT * FROM Timeline WHERE Blackspot=0")

        for entry in tbl_timeline:
            img = self.MakeThumbnail(os.path.join(self.imgdir, entry[1]), self.thumbsize)
            self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY, 
                                             wx.BitmapFromImage(img),name=entry[1]) 
            self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
            self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick )
            self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease )

            logging.exception(self.imageCtrl.GetId() )
            self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 )

        self.Layout()
        self.panel3.SetFocus()
        self.BindKeys(dbfile)

        self.hbox2.Layout()
        self.panel3.Refresh()
        self.panel3.Update()

        self.Refresh()
gui.py 文件源码 项目:stopgo 作者: notklaatu 项目源码 文件源码 阅读 41 收藏 0 点赞 0 评论 0
def TakeSnapshot(self,e,args):

        logging.exception('CAPTURE')
        if self.camset == 1:
            self.framlog += 1

            #print(self.camhero)#DEBUG
            vidcap = vlc.libvlc_video_take_snapshot(self.player,0,os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'),0,0)
            self.cur.execute('INSERT INTO Timeline VALUES(Null,?,?)', (str(self.framlog).zfill(3)+'.png',0))
            # add graphically to timeline
            img = self.MakeThumbnail(os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png'), self.thumbsize)
            self.imageCtrl = wx.StaticBitmap(self.panel3, wx.ID_ANY, wx.BitmapFromImage(img),name=str(self.framlog).zfill(3)+'.png') 
            self.imageCtrl.SetBitmap(wx.BitmapFromImage(img))
            self.imageCtrl.Bind( wx.EVT_LEFT_DOWN, self.OnLeftClick )
            self.imageCtrl.Bind( wx.EVT_LEFT_UP, self.OnLeftRelease )
            logging.exception(self.imageCtrl.GetId() )
            self.hbox2.Add( self.imageCtrl, 0, wx.ALL, 5 )

            # scroll right 100% to get close to new frame
            self.panel3.Scroll(self.thumbsize,0)
            self.Layout()
            # draw new frame
            self.hbox2.Layout()
            self.panel3.Refresh()
            # scroll WAY right again to show frame
            self.panel3.Scroll(200,0)
            # send the shot to onion skin
            img = os.path.join(self.imgdir, str(self.framlog).zfill(3)+'.png')
            self.OnionSkin(img)
            logging.exception(self.framlog)

        else:
            dlg = wx.MessageDialog(self, 'Please select your camera first.','',wx.OK | wx.ICON_ERROR)
            val = dlg.ShowModal()
            if val == wx.ID_OK:
                dlg.Destroy()
            if val == wx.ID_CANCEL:
                dlg.Destroy()

        self.player.play()
        self.brec.SetBitmapLabel(self.brecicon)
FancyTabNotebook.py 文件源码 项目:fmc-dialer 作者: sguron 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def OnMouseLeftDown(self, event):
        """
        Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`ImageContainer`.

        :param `event`: a :class:`MouseEvent` event to be processed.
        """

        ImageContainerBase.OnMouseLeftDown(self, event)
        event.Skip()
common.py 文件源码 项目:bonsu 作者: bonsudev 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, id=wx.ID_ANY, style=wx.ALIGN_LEFT, size=(-1,-1), spinfunc=None):
        wx.Panel.__init__(self, parent)
        self.hbox = wx.BoxSizer(wx.HORIZONTAL)
        self.buttonP = wx.Button(self, -1, label="+", size=size)
        self.buttonM = wx.Button(self, -1, label="-", size=size)
        self.buttonP.Bind(wx.EVT_BUTTON, self.OnP)
        self.buttonM.Bind(wx.EVT_BUTTON, self.OnM)
        self.repeatTimerP = wx.Timer(self)
        self.repeatTimerM = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.RepeatValueP, self.repeatTimerP)
        self.Bind(wx.EVT_TIMER, self.RepeatValueM, self.repeatTimerM)
        self.buttonP.Bind(wx.EVT_LEFT_DOWN, self.OnButPDown)
        self.buttonM.Bind(wx.EVT_LEFT_DOWN, self.OnButMDown)
        self.buttonP.Bind(wx.EVT_LEFT_UP, self.OnButPUp)
        self.buttonM.Bind(wx.EVT_LEFT_UP, self.OnButMUp)
        self.hbox.Add(self.buttonM, 0)
        self.hbox.Add(self.buttonP, 0)
        self.SetSizer(self.hbox)
        self.Fit()
        self.Layout()
        self.Show()
        self.max = 0
        self.min = 0
        self.range = 0
        self.value = 0
        self.SpinFunc = spinfunc
        self.n = 1
        self.t1 = time()
        self.t2 = time()
MeshCanvas.py 文件源码 项目:laplacian-meshes 作者: bmershon 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        attribs = (glcanvas.WX_GL_RGBA, glcanvas.WX_GL_DOUBLEBUFFER, glcanvas.WX_GL_DEPTH_SIZE, 24)
        glcanvas.GLCanvas.__init__(self, parent, -1, attribList = attribs)    
        self.context = glcanvas.GLContext(self)

        self.parent = parent
        #Camera state variables
        self.size = self.GetClientSize()
        #self.camera = MouseSphericalCamera(self.size.x, self.size.y)
        self.camera = MousePolarCamera(self.size.width, self.size.height)

        #Main state variables
        self.MousePos = [0, 0]
        self.bbox = BBox3D()  

        #Face mesh variables and manipulation variables
        self.mesh = None
        self.meshCentroid = None
        self.displayMeshFaces = True
        self.displayMeshEdges = False
        self.displayMeshVertices = True
        self.displayVertexNormals = False
        self.displayFaceNormals = False
        self.useLighting = True
        self.useTexture = False

        self.GLinitialized = False
        #GL-related events
        wx.EVT_ERASE_BACKGROUND(self, self.processEraseBackgroundEvent)
        wx.EVT_SIZE(self, self.processSizeEvent)
        wx.EVT_PAINT(self, self.processPaintEvent)
        #Mouse Events
        wx.EVT_LEFT_DOWN(self, self.MouseDown)
        wx.EVT_LEFT_UP(self, self.MouseUp)
        wx.EVT_RIGHT_DOWN(self, self.MouseDown)
        wx.EVT_RIGHT_UP(self, self.MouseUp)
        wx.EVT_MIDDLE_DOWN(self, self.MouseDown)
        wx.EVT_MIDDLE_UP(self, self.MouseUp)
        wx.EVT_MOTION(self, self.MouseMotion)
waveform.py 文件源码 项目:pyjam 作者: 10se1ucgo 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, file):
        super(WaveformPlot, self).__init__(parent=parent, title="pyjam Waveform Viewer",
                                           style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER)

        self.file = file

        self.plot = plot.PlotCanvas(self)
        self.plot.canvas.Bind(wx.EVT_LEFT_DOWN, self.lmb_down)
        self.plot.canvas.Bind(wx.EVT_LEFT_UP, self.lmb_up)
        self.plot.canvas.Bind(wx.EVT_MOTION, self.mouse_motion)
        self.plot.EnableAxesValues = (True, False, False, False)
        self.plot.EnableGrid = (True, False)
        self.plot.AbsScale = (True, False)
        self.plot.EnableAntiAliasing = True

        self.panel = WaveformPanel(self)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.plot, 1, wx.EXPAND, 0)
        sizer.Add(self.panel, 0, wx.EXPAND, 0)
        self.SetSizerAndFit(sizer)
        self.SetSize(800, self.GetSize()[1])
        self.SetMinSize(self.GetSize())

        self.player = wx.media.MediaCtrl(parent=self, style=wx.SIMPLE_BORDER)

        self.volume = 25
        self.selected = np.array([0.0, 0.0])
        self.maximum = 0.0
        self.minimum = 0.0
        self.selection_drawn = False
        self.resized = False

        self.timer = wx.Timer(self)

        self.Bind(wx.EVT_SIZE, self.on_size)
        self.Bind(wx.EVT_TIMER, self.on_timer)
        self.Bind(wx.EVT_IDLE, self.on_idle)
        self.Bind(wx.EVT_CLOSE, self.on_exit)

        self.load()
sliders.py 文件源码 项目:pyDataView 作者: edwardsmith999 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, parent, gap=12, *args, **kwargs):
        wx.Slider.__init__(self, parent, *args, **kwargs)
        self.gap = gap
        self.parent = self.GetParent() 
        self.Bind(wx.EVT_LEFT_DOWN, self.OnClick)
entitypicker.py 文件源码 项目:Turrican2Editor 作者: GitExl 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER):
        wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style)

        self.Viewport = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
        self.Scrollbar = wx.ScrollBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_VERTICAL)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.Viewport, 1, wx.EXPAND, 0)
        sizer.Add(self.Scrollbar, 0, wx.EXPAND, 0)

        self.SetSizer(sizer)
        self.Layout()
        sizer.Fit(self)

        self._presenter = Presenter.from_window(self.Viewport.GetHandle(), config.SCALE)

        self._graphics = None
        self._font = None
        self._entities = None

        self._selected_index = -1

        self.Viewport.Bind(wx.EVT_PAINT, self.paint)
        self.Viewport.Bind(wx.EVT_SIZE, self.resize)
        self.Viewport.Bind(wx.EVT_MOUSEWHEEL, self.mouse_wheel)
        self.Viewport.Bind(wx.EVT_LEFT_DOWN, self.mouse_left_down)
        self.Scrollbar.Bind(wx.EVT_SCROLL, self.scroll)
tileselector.py 文件源码 项目:Turrican2Editor 作者: GitExl 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER):
        wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style)

        self.Viewport = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
        self.Scrollbar = wx.ScrollBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_VERTICAL)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.Viewport, 1, wx.EXPAND, 0)
        sizer.Add(self.Scrollbar, 0, wx.EXPAND, 0)

        self.SetSizer(sizer)
        self.Layout()
        sizer.Fit(self)

        self.Scrollbar.SetScrollbar(0, 0, 0, 0)

        self._presenter = Presenter.from_window(self.Viewport.GetHandle(), config.SCALE)
        self._camera = Camera(0, 0, 0, 0)

        self._tilemap = None
        self._tileset = None
        self._select_start = None
        self._select_end = None

        self._show_collision = False

        self.Viewport.Bind(wx.EVT_PAINT, self.paint)
        self.Viewport.Bind(wx.EVT_SIZE, self.resize)
        self.Viewport.Bind(wx.EVT_MOUSEWHEEL, self.mouse_wheel)
        self.Viewport.Bind(wx.EVT_LEFT_DOWN, self.mouse_left_down)
        self.Viewport.Bind(wx.EVT_LEFT_UP, self.mouse_left_up)
        self.Viewport.Bind(wx.EVT_MOTION, self.mouse_move)
        self.Scrollbar.Bind(wx.EVT_SCROLL, self.scroll)
LogViewer.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent, size):
        wx.Panel.__init__(self, parent, size=size)
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_MOTION, self.OnMotion)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.Bind(wx.EVT_SIZE, self.OnResize)

        self.ThumbPosition = 0.  # -1 <= ThumbPosition <= 1
        self.ThumbScrollingStartPos = None
PouInstanceVariablesPanel.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
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)
DebugVariableTextViewer.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, window, items=[]):
        """
        Constructor
        @param parent: Parent wx.Window of DebugVariableText
        @param window: Reference to the Debug Variable Panel
        @param items: List of DebugVariableItem displayed by Viewer
        """
        DebugVariableViewer.__init__(self, window, items)

        wx.Panel.__init__(self, parent)
        # Set panel background colour
        self.SetBackgroundColour(wx.WHITE)
        # Define panel drop target
        self.SetDropTarget(DebugVariableTextDropTarget(self, window))

        # Bind events
        self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
        self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
        self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDClick)
        self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter)
        self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave)
        self.Bind(wx.EVT_SIZE, self.OnResize)
        self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
        self.Bind(wx.EVT_PAINT, self.OnPaint)

        # Define panel min size for parent sizer layout
        self.SetMinSize(wx.Size(0, 25))

        # Add buttons to Viewer
        for bitmap, callback in [("force", self.OnForceButton),
                                 ("release", self.OnReleaseButton),
                                 ("delete_graph", self.OnCloseButton)]:
            self.Buttons.append(GraphButton(0, 0, bitmap, callback))
TextCtrlAutoComplete.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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)
ConfTreeNodeEditor.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def GenerateMethodButtonSizer(self):
        normal_bt_font = wx.Font(faces["size"] / 3,    wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"])
        mouseover_bt_font = wx.Font(faces["size"] / 3, wx.DEFAULT, wx.NORMAL, wx.NORMAL, faceName=faces["helv"], underline=True)

        msizer = wx.BoxSizer(wx.HORIZONTAL)

        for confnode_method in self.Controler.ConfNodeMethods:
            if "method" in confnode_method and confnode_method.get("shown", True):
                button = GenBitmapTextButton(self.Editor,
                                             bitmap=GetBitmap(confnode_method.get("bitmap", "Unknown")),
                                             label=confnode_method["name"],
                                             style=wx.NO_BORDER)
                button.SetFont(normal_bt_font)
                button.SetToolTipString(confnode_method["tooltip"])
                if confnode_method.get("push", False):
                    button.Bind(wx.EVT_LEFT_DOWN, self.GetButtonCallBackFunction(confnode_method["method"], True))
                else:
                    button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(confnode_method["method"]), button)
                # a fancy underline on mouseover

                def setFontStyle(b, s):
                    def fn(event):
                        b.SetFont(s)
                        b.Refresh()
                        event.Skip()
                    return fn
                button.Bind(wx.EVT_ENTER_WINDOW, setFontStyle(button, mouseover_bt_font))
                button.Bind(wx.EVT_LEAVE_WINDOW, setFontStyle(button, normal_bt_font))
                # hack to force size to mini
                if not confnode_method.get("enabled", True):
                    button.Disable()
                msizer.AddWindow(button, flag=wx.ALIGN_CENTER)
        return msizer
widgets.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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)
toolsloader.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def build_tools(parent, toolspath):
    global host
    host = parent
    ## get tool datas from the loader.build_tools(toolspath)
    ## then generate toolsbar
    datas = loader.build_tools(toolspath)
    toolsbar = buildToolsBar(parent, datas)
    gifpath = os.path.join(root_dir, "tools/drop.gif")
    #btn = wx.BitmapButton(parent, wx.ID_ANY, wx.Bitmap(gifpath), wx.DefaultPosition, (30,30), wx.BU_AUTODRAW)
    #btn.Bind(wx.EVT_LEFT_DOWN, lambda x:menu_drop(parent, toolsbar, datas, btn, x))   
    return toolsbar#, btn
toolsloader.py 文件源码 项目:imagepy 作者: Image-Py 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def f(plg, e):
    ##! TODO: What's this? for wx.EVT_LEFT_DOWN
    plg.start()
    #print e.GetEventObject().SetBackgroundColour( 
    #    wx.SystemSettings.GetColour( wx.SYS_COLOUR_HIGHLIGHT ) )
    if isinstance(plg, Tool): 
        e.Skip()


问题


面经


文章

微信
公众号

扫码关注公众号