Python wx 模块,EVT_ACTIVATE 实例源码

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

项目:CSB    作者:csb-toolbox    | 项目源码 | 文件源码
def _add(self, figure):

        wx = self._wx
        FigureFrameWx = self._FigureFrameWx

        if figure not in self._figures:

            frame = FigureFrameWx(figure._figure_number, figure)
            frame.Show()
            frame.Bind(wx.EVT_ACTIVATE, lambda e: e.GetEventObject().Layout())
            frame.Bind(wx.EVT_CLOSE, lambda e: self.invoke(self._hide, figure))

            self._figures[figure] = frame
项目:hachoir3    作者:vstinner    | 项目源码 | 文件源码
def on_frame_view_ready(self, dispatcher, view):
        assert view is not None
        view.Bind(wx.EVT_ACTIVATE, self.on_activated)
        view.Bind(wx.EVT_SHOW, self.on_shown)
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def __init__(self, parent=None):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY,
                            title = wx.EmptyString,
                            pos = wx.DefaultPosition,
                            size = wx.Size( -1,-1 ),
                            style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        logopath = os.path.join(root_dir, 'data/logo.ico')
        self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) )
        self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO))
        self.SetSizeHints( wx.Size( 560,-1 ), wx.DefaultSize )
        WindowsManager.add(self)
        print('frame added')

        self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
        self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) )

        sizer = wx.BoxSizer( wx.VERTICAL )
        self.txt_info = wx.StaticText( self, wx.ID_ANY,
                                       '500*500 pixels 173k',
                                       wx.DefaultPosition, wx.DefaultSize, 0 )
        self.txt_info.Wrap( -1 )
        sizer.Add( self.txt_info, 0, wx.ALL, 0 )

        self.canvas = Canvas(self)
        self.canvas.fit = self

        sizer.Add( self.canvas, 1, wx.EXPAND |wx.ALL, 0 )

        self.page = wx.ScrollBar( self, wx.ID_ANY,
                                  wx.DefaultPosition, wx.DefaultSize, wx.SB_HORIZONTAL)

        self.page.SetScrollbar(0,0,0,0, refresh=True)
        sizer.Add( self.page, 0, wx.ALL|wx.EXPAND, 0 )
        #self.page.Hide()
        self.SetSizer(sizer)
        self.Layout()

        self.Bind(wx.EVT_IDLE, self.on_idle)
        self.Bind(wx.EVT_SCROLL, self.on_scroll)
        self.Bind(wx.EVT_ACTIVATE, self.on_valid)
        self.Bind(wx.EVT_CLOSE, self.on_close)
        self.canvas.Bind(wx.EVT_CHAR, self.on_key)
        self.canvas.SetFocus()
        # panel.Bind(wx.EVT_CHAR, self.OnKeyDown)
        self.opage = 0
        self.Fit()

        self.SetAcceleratorTable(IPy.curapp.shortcut)