python类EVT_TIMER的实例源码

ToolTipProducer.py 文件源码 项目:beremiz 作者: nucleron 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """
        Constructor
        @param parent: Parent Viewer
        """
        self.Parent = parent

        self.ToolTip = None
        self.ToolTipPos = None

        # Timer for firing Tool tip display
        self.ToolTipTimer = wx.Timer(self.Parent, -1)
        self.Parent.Bind(wx.EVT_TIMER,
                         self.OnToolTipTimer,
                         self.ToolTipTimer)
MWScoreGUI.py 文件源码 项目:MechWarfareScoring 作者: artanz 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__( self ):
        wx.Frame.__init__( self, None, wx.ID_ANY, style=wx.DEFAULT_FRAME_STYLE, name="MWScore Server" )

        # MWScore ScoreServer.
        self.ScoreServer = MWScore.ScoreServer()

        # Menu Bar
        self.MenuBar = wx.MenuBar()
        self.FileMenu = wx.Menu()
        self.TransponderMenu = wx.Menu()
        self.SocketMenu = wx.Menu()
        self.MatchMenu = wx.Menu()

        self.FileMenu.Append( self.ID_QUIT, "Quit" )
        self.Bind( wx.EVT_MENU, self.Quit, id=self.ID_QUIT )

        self.TransponderMenu.Append( self.ID_TRANSPONDERSETUP, "Setup" )
        self.Bind( wx.EVT_MENU, self.TransponderSetup, id=self.ID_TRANSPONDERSETUP )

        self.SocketMenu.Append( self.ID_SOCKETSETUP, "Setup" )
        self.Bind( wx.EVT_MENU, self.SocketSetup, id=self.ID_SOCKETSETUP )

        self.MatchMenu.Append( self.ID_MATCHSETUP, "Setup" )
        self.MatchMenu.Append( self.ID_MATCHSTART, "Start/Resume" )
        self.MatchMenu.Append(self.ID_MATCHPAUSE, "Pause" )
        self.MatchMenu.Append(self.ID_MATCHRESET, "Reset" )
        self.MatchMenu.Append(self.ID_MATCHRESETHP, "Reset HP" )
        self.Bind( wx.EVT_MENU, self.MatchSetup, id=self.ID_MATCHSETUP )
        self.Bind( wx.EVT_MENU, self.MatchStart, id=self.ID_MATCHSTART )
        self.Bind( wx.EVT_MENU, self.MatchPause, id=self.ID_MATCHPAUSE )
        self.Bind( wx.EVT_MENU, self.MatchReset, id=self.ID_MATCHRESET )
        self.Bind( wx.EVT_MENU, self.MatchResetHP, id=self.ID_MATCHRESETHP )

        self.MenuBar.Append( self.FileMenu, "&File" )
        self.MenuBar.Append( self.MatchMenu, "&Match" )
        self.MenuBar.Append( self.TransponderMenu, "&Transponder" )
        self.MenuBar.Append( self.SocketMenu, "&Socket" )

        self.SetMenuBar( self.MenuBar )


        # Panel
        self.Panel = MatchPanel( self, -1 )

        # Frame Update Timer
        self.Timer = wx.Timer( self, self.FRAME_UPDATE_TIMER_ID )
        self.Timer.Start(100)
        wx.EVT_TIMER( self, self.FRAME_UPDATE_TIMER_ID, self.OnTimer )

        self.Show( True )
                self.SetTitle("Mech Warfare Match Score")

    # Updates the frames panel and Broadcasts match data to clients
MWCam.py 文件源码 项目:MechWarfareScoring 作者: artanz 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__( self ):
        wx.Frame.__init__( self, None, wx.ID_ANY, "MWCam", style=wx.DEFAULT_FRAME_STYLE & ~wx.RESIZE_BORDER )

        # Socket Cleint
        self.SocketClient = MWScore.SocketClient( SOCKET_CLIENT_HOST, SOCKET_CLIENT_PORT )
        self.SocketClient.StartThread()

        # IP Camera
        #self.Camera = Trendnet( CAMERA_IP, CAMERA_USERNAME, CAMERA_PASSWORD )
        self.Camera = DLink( CAMERA_IP, CAMERA_USERNAME, CAMERA_PASSWORD )
        self.Camera.Connect()

        # Camera Panel
        self.CameraPanel = CameraPanel( self, self.Camera, self.SocketClient )

        # Frame timer
        self.Timer = wx.Timer( self, self.ID_FRAME_REFRESH )
        self.Timer.Start(10)
        wx.EVT_TIMER( self, self.ID_FRAME_REFRESH, self.Refresh )

        # Frame Sizer
        self.Sizer = None
        self.Size()

        # Show frame
        self.Show( True )
janet.py 文件源码 项目:Janet 作者: nosmokingbandit 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def setup_gamepad(self):
        self.gamepad_connected = False
        self.stick = wx.Joystick()
        self.stick.SetCapture(self)
        self.gamepad_timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.poll_gamepad, self.gamepad_timer)
        self.gamepad_timer.Start(150)  # 150ms seems to be a good rate, we aren't playing Street Fighter or anything.
janet.py 文件源码 项目:Janet 作者: nosmokingbandit 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def create_timer(self):
        # See also "Making a render loop":
        # http://wiki.wxwidgets.org/Making_a_render_loop
        # Another way would be to use EVT_IDLE in MainFrame.
        self.timer = wx.Timer(self, self.timer_id)
        self.timer.Start(10)  # 10ms timer
        wx.EVT_TIMER(self, self.timer_id, self.on_timer)
app.py 文件源码 项目:bittray 作者: nkuttler 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def set_icon_timer(self):
        """
        Sets the icon timer to kick off the main loop.
        """
        self.icon_timer = wx.Timer(self, ID_ICON_TIMER)
        wx.EVT_TIMER(self, ID_ICON_TIMER, self.do_update)
        self.icon_timer.Start(self.conf.get_int('Behavior', 'timer'))
        self.do_update()  # Fire the first right away
main.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        width, height = wx.DisplaySize()
        self.picPaths = []
        self.currentPicture = 0
        self.totalPictures = 0
        self.photoMaxSize = height - 200
        Publisher().subscribe(self.updateImages, ("update images"))

        self.slideTimer = wx.Timer(None)
        self.slideTimer.Bind(wx.EVT_TIMER, self.update)

        self.layout()
flashing_text.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        self.font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        self.label = "I flash a LOT!"
        self.flashingText = wx.StaticText(self, label=self.label)
        self.flashingText.SetFont(self.font)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        self.timer.Start(1000)
changing_text.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        """Constructor"""
        wx.Panel.__init__(self, parent)

        self.font = wx.Font(12, wx.DEFAULT, wx.NORMAL, wx.NORMAL)
        self.flashingText = wx.StaticText(self, label="I flash a LOT!")
        self.flashingText.SetFont(self.font)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        self.timer.Start(1000)
simple_timer_2.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self):
        wx.Frame.__init__(self, None, title="Timer Tutorial 1",
                          size=(500,500))

        panel = wx.Panel(self, wx.ID_ANY)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)

        self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start")
        self.toggleBtn.Bind(wx.EVT_BUTTON, self.onToggle)
simple_timer.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self):
        wx.Frame.__init__(self, None, title="Timer Tutorial 1",
                          size=(500,500))

        panel = wx.Panel(self, wx.ID_ANY)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)

        self.toggleBtn = wx.Button(panel, wx.ID_ANY, "Start")
        self.toggleBtn.Bind(wx.EVT_BUTTON, self.onToggle)
focus_finder.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self):
        wx.Frame.__init__(self, None, title="Focus Finder")

        panel = wx.Panel(self, wx.ID_ANY)
        panel.Bind(wx.EVT_SET_FOCUS, self.onFocus)
        txt = wx.StaticText(
            panel, label="This label cannot receive focus")

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.onTimer)
        self.timer.Start(1000)
main.py 文件源码 项目:wxpythoncookbookcode 作者: driscollis 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self):
        """Constructor"""
        wx.Frame.__init__(self, None, title="Panel Smacker")
        self.panelOne = PanelOne(self)
        self.time2die = 10

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        self.timer.Start(1000)

        self.sizer = wx.BoxSizer(wx.VERTICAL)
        self.sizer.Add(self.panelOne, 1, wx.EXPAND)
        self.SetSizer(self.sizer)
DQN001.py 文件源码 项目:DeepQNetworkTest 作者: Chachay 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, parent=None, id=-1, title=None):
        wx.Frame.__init__(self, parent, id, title)
        self.panel = wx.Panel(self, size=(640, 480))
        self.panel.SetBackgroundColour('WHITE')
        self.Fit()

        self.A = Agent(self.panel, 150, 100 )

        self.greenB = [Ball(rnd.randint(40, 600),rnd.randint(40, 440), 
                        wx.Colour(112,173,71), property =  1) for i in range(0, 15)]
        self.redB  = [Ball(rnd.randint(40, 600),rnd.randint(40, 440), 
                        wx.Colour(237,125,49), property = 2) for i in range(0, 10)]

        # OutrBox
        self.Box = Walls(640, 480, 0, 480)
        self.Box.addPoint(0,0)
        self.Box.addPoint(640,0)
        self.Box.addPoint(640,480)

        # Wall in the world
        self.WallA = Walls(96, 90, 256, 90)
        self.WallA.addPoint(256, 390)
        self.WallA.addPoint(96,390)

        self.Bind(wx.EVT_CLOSE, self.CloseWindow)

        self.cdc = wx.ClientDC(self.panel)
        w, h = self.panel.GetSize()
        self.bmp = wx.EmptyBitmap(w,h)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.timer.Start(20)
gui.py 文件源码 项目:stopgo 作者: notklaatu 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, parent, id, title, style, clargs):
        if _plat.startswith('win'):
            HANDLER = logging.handlers.WatchedFileHandler(os.environ.get("LOGFILE", os.path.join(os.path.expanduser('~'), 'stopgo.log')))
        else:
            HANDLER = logging.handlers.WatchedFileHandler(os.environ.get("LOGFILE", os.path.join('/','tmp','stopgo.log')))

        FORMATTER = logging.Formatter(logging.BASIC_FORMAT)
        HANDLER.setFormatter(FORMATTER)

        if not clargs.has_key('verbose'):
            root = logging.getLogger()
            root.setLevel(os.environ.get("LOGLEVEL", "INFO"))
            root.addHandler(HANDLER)

        logging.exception("Debugging on.")
        #First retrieve the screen size of the device
        self.screenSize = wx.DisplaySize()
        self.framlog = 0
        self.thumbsize = 180
        self.camset = 0
        self.prefdate = 0
        prefstr = pref.PrefProbe().PrefGet()
        logging.exception(prefstr)
        logging.exception(type(prefstr))
        self.myprefs = prefstr
        #self.myprefs = json.dumps(prefstr, sort_keys=True)
        #self.screenSize = [ 786, 768 ]
        self.screenWidth = int(self.screenSize[0])
        self.screenHeight = int(self.screenSize[1])
        #self.screenWidth = int(self.screenSize[0] / 3)
        #self.screenHeight = int(self.screenSize[1] / 1.5)
        self.hasSelected = False
        self.previous = 0
        #fontsy = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT).GetPixelSize()        
        wx.Frame.__init__(self, parent, id, title, size=(self.screenWidth, self.screenHeight), style=wx.DEFAULT_FRAME_STYLE)
        self.timer = wx.Timer(self, ID_TIMER)
        self.blick = 0
        self.Bind(wx.EVT_TIMER, self.OnTimer, id=ID_TIMER)
        self.Bind(wx.EVT_CHAR_HOOK, lambda event, args=(True, ):self.OnKeyDown(event, args))
        self.clargs = clargs
        logging.exception(prefstr)
        self.InitUI()
SamplePanel.py 文件源码 项目:irida-miseq-uploader 作者: phac-nml 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent, sample, run, api):
        """Initialize the SamplePanel.

        Args:
            parent: the parent Window for this panel.
            sample: the sample that should be displayed.
            run: the run that this sample belongs to.
            api: an initialized instance of an API for interacting with IRIDA.
        """
        wx.Panel.__init__(self, parent)
        self._sample = sample

        self._timer = wx.Timer(self)

        self._progress_value = 0
        self._last_timer_progress = 0
        self._progress = None
        self._progress_max = sample.get_files_size()

        self._sizer = wx.BoxSizer(wx.HORIZONTAL)

        self._label = wx.StaticText(self, label=self._sample.get_id())
        self._sizer.Add(self._label, proportion=2)
        self._status_label = wx.StaticText(self, label="Validating...")
        self._sizer.Add(self._status_label)

        self.SetSizer(self._sizer)

        self.Bind(wx.EVT_TIMER, self._update_progress_timer, self._timer)

        self.Layout()

        pub.subscribe(self._upload_completed, sample.upload_completed_topic)
        pub.subscribe(self._upload_progress, sample.upload_progress_topic)

        if not sample.already_uploaded:
            pub.subscribe(self._validation_results, sample.online_validation_topic)
            pub.subscribe(self._upload_started, sample.upload_started_topic)
            pub.subscribe(self._upload_failed, sample.upload_failed_topic)
            threading.Thread(target=project_exists, kwargs={"api": api, "project_id": sample.get_project_id(), "message_id": sample.online_validation_topic}).start()
        else:
            # this sample is already uploaded, so inform the run panel to move
            # it down to the bottom of the list.
            send_message(sample.upload_completed_topic, sample=sample)
            self._status_label.Destroy()
            self._upload_completed()
WPKG-GP-Client_phoenix.py 文件源码 项目:wpkg-gp-client 作者: sonicnkt 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def __init__(self, trayicon, tooltip):
        super(TaskBarIcon, self).__init__()
        self.show_no_updates = False

        # Set trayicon and tooltip
        icon = wx.Icon(wx.Bitmap(trayicon))
        self.SetIcon(icon, tooltip)

        self.Bind(wx.adv.EVT_TASKBAR_LEFT_DCLICK, self.on_upgrade)
        self.Bind(wx.adv.EVT_TASKBAR_BALLOON_CLICK, self.on_bubble)
        self.upd_error_count = 0
        self.checking_updates = False
        self.updates_available = False
        self.shutdown_scheduled = False
        self.reboot_scheduled = False
        self.bootup_time = getBootUp()
        if update_interval and update_method:
            self.timer = wx.Timer(self)
            self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
            self.timer.Start(update_interval)
            if update_startup:
                self.on_timer(None)
        if check_bootup_log:
            last_check = check_file_date(xml_file)
            now = datetime.datetime.now()
            if (self.bootup_time + datetime.timedelta(hours=1) > now) and \
               (self.bootup_time + datetime.timedelta(minutes=30) > last_check):
                log, errorlog, reboot = check_eventlog(self.bootup_time)
                if errorlog:
                    error_str = _(u"Update error detected\n"
                                  u"during system start up.")
                    self.ShowBalloon(title=_(u'WPKG Error'), text=error_str, msec=20*1000, flags=wx.ICON_ERROR)
                    title = _(u"System start error")
                    dlg = ViewLogDialog(title=title,log=errorlog)
                    dlg.ShowModal()
        if check_last_upgrade:
            # Check if the last changes to the local wpkg.xml are older than a specific time
            # Inform USER that he should upgrade the System
            last_check = check_file_date(xml_file)
            if last_check < (datetime.datetime.now() - datetime.timedelta(days=last_upgrade_interval)):
                dlg_str = _(u"System should be updated!\n\n"
                            u"System wasn't updated in over {} days.").format(str(last_upgrade_interval))
                dlg = wx.MessageDialog(None, dlg_str, _(u"Attention!"), wx.OK | wx.ICON_EXCLAMATION)
                dlg.ShowModal()
                self.on_upgrade(None)
WPKG-GP-Client.py 文件源码 项目:wpkg-gp-client 作者: sonicnkt 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, trayicon, tooltip):
        super(TaskBarIcon, self).__init__()
        self.show_no_updates = False

        # Set trayicon and tooltip
        icon = wx.IconFromBitmap(wx.Bitmap(trayicon))
        self.SetIcon(icon, tooltip)

        self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, self.on_upgrade)
        self.Bind(wx.EVT_TASKBAR_BALLOON_CLICK, self.on_bubble)
        self.upd_error_count = 0
        self.checking_updates = False
        self.updates_available = False
        self.shutdown_scheduled = False
        self.reboot_scheduled = False
        self.bootup_time = getBootUp()
        if update_interval and update_method:
            self.timer = wx.Timer(self)
            self.Bind(wx.EVT_TIMER, self.on_timer, self.timer)
            self.timer.Start(update_interval)
            if update_startup:
                self.on_timer(None)
        if check_bootup_log:
            last_check = ReadLastSyncTime()
            now = datetime.datetime.now()
            if (self.bootup_time + datetime.timedelta(hours=1) > now) and \
               (self.bootup_time + datetime.timedelta(minutes=30) > last_check):
                log, errorlog, reboot = check_eventlog(self.bootup_time)
                if errorlog:
                    error_str = _(u"Update error detected\n"
                                  u"during system start up.")
                    self.ShowBalloon(title=_(u'WPKG Error'), text=error_str, msec=20*1000, flags=wx.ICON_ERROR)
                    title = _(u"System start error")
                    dlg = ViewLogDialog(title=title,log=errorlog)
                    dlg.ShowModal()
        if check_last_upgrade:
            # Check when WPKG-GP sucessfully synced the last time
            # Inform USER that he should upgrade the System
            last_sync = ReadLastSyncTime()
            if last_sync:
                if last_sync < (datetime.datetime.now() - datetime.timedelta(days=last_upgrade_interval)):
                    dlg_str = _(u"System should be updated!\n\n"
                                u"System wasn't updated in over {} days.").format(str(last_upgrade_interval))
                    dlg = wx.MessageDialog(None, dlg_str, _(u"Attention!"), wx.OK | wx.ICON_EXCLAMATION)
                    dlg.ShowModal()
                    self.on_upgrade(None)
DQN003.py 文件源码 项目:DeepQNetworkTest 作者: Chachay 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, parent=None, id=-1, title=None):
        wx.Frame.__init__(self, parent, id, title)
        self.MainPanel = wx.Panel(self, size=(640, 640))
        self.MainPanel.SetBackgroundColour('WHITE')

        self.panel = wx.Panel(self.MainPanel, size = (640,480))
        self.panel.SetBackgroundColour('WHITE')
        self.plotter = plot.PlotCanvas(self.MainPanel, size =(640, 640-480))
        self.plotter.SetEnableZoom(False)
        self.plotter.SetEnableLegend(True)
        self.plotter.SetFontSizeLegend(10.5)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.panel)
        mainSizer.Add(self.plotter)

        self.SetSizer(mainSizer)
        self.Fit()

        self.A = Agent(self.panel, 240, 49 )
        self.B = Agent(self.panel, 240, 49)
        self.B.B_color = wx.Colour(112,173,71)

        # OutrBox
        self.Box = Walls(640, 479, 0, 479)
        self.Box.addPoint(0,0)
        self.Box.addPoint(640,0)
        self.Box.addPoint(640,479)

        # Oval Course
        Rad = 190.0
        Poly = 16
        self.Course = Walls(240, 50, 640-(50+Rad),50)
        for i in range(1, Poly):
            self.Course.addPoint(Rad*math.cos(-np.pi/2.0 + np.pi*i/Poly)+640-(50+Rad), 
                                Rad*math.sin(-np.pi/2.0 + np.pi*i/Poly)+50+Rad)
        self.Course.addPoint(240, 50+Rad*2)
        for i in range(1, Poly):
            self.Course.addPoint(Rad*math.cos(np.pi/2.0 + np.pi*i/Poly)+(50+Rad), 
                                Rad*math.sin(np.pi/2.0 + np.pi*i/Poly)+50+Rad)
        self.Course.addPoint(240,50)

        self.Bind(wx.EVT_CLOSE, self.CloseWindow)

        self.cdc = wx.ClientDC(self.panel)
        w, h = self.panel.GetSize()
        self.bmp = wx.EmptyBitmap(w,h)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.timer.Start(20)

        self.i = 0
        self.tmp_sum = 0.0
        self.data = []
DQN002.py 文件源码 项目:DeepQNetworkTest 作者: Chachay 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, parent=None, id=-1, title=None):
        wx.Frame.__init__(self, parent, id, title)
        self.MainPanel = wx.Panel(self, size=(640, 640))
        self.MainPanel.SetBackgroundColour('WHITE')

        self.panel = wx.Panel(self.MainPanel, size = (640,480))
        self.panel.SetBackgroundColour('WHITE')
        self.plotter = plot.PlotCanvas(self.MainPanel, size =(640, 640-480))
        self.plotter.SetEnableZoom(False)
        self.plotter.SetEnableLegend(True)
        self.plotter.SetFontSizeLegend(10.5)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.panel)
        mainSizer.Add(self.plotter)

        self.SetSizer(mainSizer)
        self.Fit()

        self.A = Agent(self.panel, 150, 100 )
        self.B = Agent(self.panel, 400, 300, model = self.A.model)
        self.C = Agent(self.panel, 400, 150, model = self.A.model)
        self.D = Agent(self.panel, 320, 240, model = self.A.model)

        self.greenB = [Ball(rnd.randint(40, 600),rnd.randint(40, 440), 
                        wx.Colour(112,173,71), property =  1) for i in range(0, 15)]
        self.redB  = [Ball(rnd.randint(40, 600),rnd.randint(40, 440), 
                        wx.Colour(237,125,49), property = 2) for i in range(0, 10)]

        # OutrBox
        self.Box = Walls(640, 480, 0, 480)
        self.Box.addPoint(0,0)
        self.Box.addPoint(640,0)
        self.Box.addPoint(640,480)

        # Wall in the world
        self.WallA = Walls(96, 90, 256, 90)
        self.WallA.addPoint(256, 390)
        self.WallA.addPoint(96,390)

        self.Bind(wx.EVT_CLOSE, self.CloseWindow)

        self.cdc = wx.ClientDC(self.panel)
        w, h = self.panel.GetSize()
        self.bmp = wx.EmptyBitmap(w,h)

        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer)
        self.timer.Start(20)

        self.i = 0
        self.tmp_sum = 0.0
        self.data = []


问题


面经


文章

微信
公众号

扫码关注公众号