當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.QTimer方法代碼示例

本文整理匯總了Python中PyQt4.QtCore.QTimer方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.QTimer方法的具體用法?Python QtCore.QTimer怎麽用?Python QtCore.QTimer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.QtCore的用法示例。


在下文中一共展示了QtCore.QTimer方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def __init__(self, cf, parent=None):
        super(ParamManager, self).__init__(parent)
        self.cf = cf
        self.fw = {}

        self.setColumnCount(3)
        self.setHeaderLabels(['Name', 'Type', 'Value'])
        self.setAlternatingRowColors(True)

        self.timerCalib = QTimer()
        self.timerCalib.setSingleShot(True)
        self.timerCalib.setInterval(500)
        self.timerCalib.timeout.connect(lambda: self.cf.param.request_param_update("%s.%s" % ('imu_calib','gyroCalib')))


        self.cf.connected.add_callback(self.populate)
        self.cf.disconnected.add_callback(self.uppopulate)
        self.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.itemDoubleClicked.connect(self.userStartEdit) 
開發者ID:omwdunkley,項目名稱:crazyflieROS,代碼行數:21,代碼來源:paramManager.py

示例2: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def __init__(self):
        """初始化事件引擎"""
        # 事件隊列
        self.__queue = Queue()
        
        # 事件引擎開關
        self.__active = False
        
        # 事件處理線程
        self.__thread = Thread(target=self.__run)
        
        # 計時器,用於觸發計時器事件
        self.__timer = QTimer()
        self.__timer.timeout.connect(self.__onTimer)
        
        # 這裏的__handlers是一個字典,用來保存對應的事件調用關係
        # 其中每個鍵對應的值是一個列表,列表中保存了對該事件進行監聽的函數功能
        self.__handlers = defaultdict(list)
    
    # ---------------------------------------------------------------------- 
開發者ID:quantOS-org,項目名稱:TradeSim,代碼行數:22,代碼來源:eventEngine.py

示例3: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def __init__(self):
        """初始化事件引擎"""
        # 事件隊列
        self.__queue = Queue()
        
        # 事件引擎開關
        self.__active = False
        
        # 事件處理線程
        self.__thread = Thread(target = self.__run)
        
        # 計時器,用於觸發計時器事件
        self.__timer = QTimer()
        self.__timer.timeout.connect(self.__onTimer)
        
        # 這裏的__handlers是一個字典,用來保存對應的事件調用關係
        # 其中每個鍵對應的值是一個列表,列表中保存了對該事件進行監聽的函數功能
        self.__handlers = {}
        
    #---------------------------------------------------------------------- 
開發者ID:sunshinelover,項目名稱:chanlun,代碼行數:22,代碼來源:eventEngine.py

示例4: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def __init__(self):
        """初始化事件引擎"""
        # 事件隊列
        self.__queue = Queue()
        
        # 事件引擎開關
        self.__active = False
        
        # 事件處理線程
        self.__thread = Thread(target = self.__run)
        
        # 計時器,用於觸發計時器事件
        self.__timer = QTimer()
        self.__timer.timeout.connect(self.__onTimer)
        
        # 這裏的__handlers是一個字典,用來保存對應的事件調用關係
        # 其中每個鍵對應的值是一個列表,列表中保存了對該事件進行監聽的函數功能
        self.__handlers = defaultdict(list)
        
        # __generalHandlers是一個列表,用來保存通用回調函數(所有事件均調用)
        self.__generalHandlers = []
        
    #---------------------------------------------------------------------- 
開發者ID:zhengwsh,項目名稱:InplusTrader_Linux,代碼行數:25,代碼來源:eventEngine.py

示例5: init

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def init(self, history=512, autoscale=True):
        self.widget = pg.PlotWidget()
        self.widget.block = self

        self.gr_block.set_history(history)

        self.plot = self.widget.plot()
        self.plot.setPen(QtGui.QColor(self.input.color))
        #self.widget.setYRange(*self.yrange)

        self.widget.enableAutoRange('y', 0.95 if autoscale else False)

        self.buffer = []

        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.updateGUI)
        self.timer.start(100) 
開發者ID:strfry,項目名稱:OpenNFB,代碼行數:19,代碼來源:gnuradio_protocol.py

示例6: startCapture

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def startCapture(self):
        global new_user_added
        if new_user_added == True:

            self.initDir()
            self.capturing = True
            self.capture = cv2.VideoCapture(camera_port)
            self.capture.set(cv2.cv.CV_CAP_PROP_FRAME_WIDTH, self.video_size.width())
            self.capture.set(cv2.cv.CV_CAP_PROP_FRAME_HEIGHT, self.video_size.height())

            self.timer = QtCore.QTimer()
            self.timer.timeout.connect(self.display_video_stream)
            self.timer.start(30)

        else:
            self.messageLbl.setText('Warning: First create new user') 
開發者ID:aishmittal,項目名稱:Smart-Mirror,代碼行數:18,代碼來源:register.py

示例7: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def __init__(self):
        self._reads = {}
        self._writes = {}
        self._timer=QTimer()
        self._timer.setSingleShot(True)
        if QCoreApplication.startingUp():
            self.qApp=QCoreApplication([])
            self._ownApp=True
        else:
            self.qApp = QCoreApplication.instance()
            self._ownApp=False
        self._blockApp = None
        self._readWriteQ=[]
        
        """ some debugging instrumentation """
        self._doSomethingCount=0
        
        PosixReactorBase.__init__(self) 
開發者ID:eliben,項目名稱:code-for-blog,代碼行數:20,代碼來源:qt4reactor.py

示例8: qtstart

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def qtstart():
    global ctimer, wxtimer, temptimer
    global manager
    global objradar1
    global objradar2
    global objradar3
    global objradar4

    getallwx()

    gettemp()

    objradar1.start(Config.radar_refresh * 60)
    objradar1.wxstart()
    objradar2.start(Config.radar_refresh * 60)
    objradar2.wxstart()
    objradar3.start(Config.radar_refresh * 60)
    objradar4.start(Config.radar_refresh * 60)

    ctimer = QtCore.QTimer()
    ctimer.timeout.connect(tick)
    ctimer.start(1000)

    wxtimer = QtCore.QTimer()
    wxtimer.timeout.connect(getallwx)
    wxtimer.start(1000 * Config.weather_refresh *
                  60 + random.uniform(1000, 10000))

    temptimer = QtCore.QTimer()
    temptimer.timeout.connect(gettemp)
    temptimer.start(1000 * 10 * 60 + random.uniform(1000, 10000))

    if Config.useslideshow:
        objimage1.start(Config.slide_time) 
開發者ID:n0bel,項目名稱:PiClock,代碼行數:36,代碼來源:PyQtPiClock.py

示例9: start

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def start(self, interval):
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.run_ss)
        self.timer.start(1000 * interval + random.uniform(1, 10))
        self.run_ss() 
開發者ID:n0bel,項目名稱:PiClock,代碼行數:7,代碼來源:PyQtPiClock.py

示例10: myquit

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def myquit(a=0, b=0):
    global objradar1, objradar2, objradar3, objradar4
    global ctimer, wtimer, temptimer

    objradar1.stop()
    objradar2.stop()
    objradar3.stop()
    objradar4.stop()
    ctimer.stop()
    wxtimer.stop()
    temptimer.stop()
    if Config.useslideshow:
        objimage1.stop()

    QtCore.QTimer.singleShot(30, realquit) 
開發者ID:n0bel,項目名稱:PiClock,代碼行數:17,代碼來源:PyQtPiClock.py

示例11: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def __init__(self, *args, **kwargs):
        MyMplCanvas.__init__(self, *args, **kwargs)
        timer = QtCore.QTimer(self)
        timer.timeout.connect(self.update_figure)
        timer.start(100) 
開發者ID:ocelot-collab,項目名稱:ocelot,代碼行數:7,代碼來源:sim_gui.py

示例12: init_ui

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def init_ui(self):
        """Init game interface."""
        board_width = self.ms_game.board_width
        board_height = self.ms_game.board_height
        self.create_grid(board_width, board_height)
        self.time = 0
        self.timer = QtCore.QTimer()
        self.timer.timeout.connect(self.timing_game)
        self.timer.start(1000) 
開發者ID:duguyue100,項目名稱:minesweeper,代碼行數:11,代碼來源:gui.py

示例13: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def __init__(self, cf, parent=None):
        super(LogManager, self).__init__(parent)
        self.cf = cf

        self.toc = None
        self.timerHZUpdate = QTimer()
        self.timerHZUpdate.timeout.connect(self.updateFreqMonitor)
        self.setFreqMonitorFreq(hz=2)
        self.estimateHzOn = True

        self.headers = ['Name','State', 'HZ Desired', 'HZ Actual']#, 'ROS']
        self.setHeaderLabels(self.headers)
        self.header().setStretchLastSection(True)
        self.header().setResizeMode(0, QHeaderView.Stretch)
        self.header().setResizeMode(1, QHeaderView.ResizeToContents)
        self.header().setResizeMode(2, QHeaderView.ResizeToContents)
        self.header().setResizeMode(3, QHeaderView.ResizeToContents)
        #self.header().setResizeMode(4, QHeaderView.ResizeToContents)
        self.setAlternatingRowColors(True)

        # So we can select which cols we can change
        self.setEditTriggers(QAbstractItemView.NoEditTriggers)
        self.itemDoubleClicked.connect(self.userStartEdit)

        # All log groups send errors to this signal
        self.sig_logError.connect(self.logError)

        self.cf.connected.add_callback(self.newToc)
        self.cf.disconnected.add_callback(self.purgeToc)

        # Yaw offset to compensate for gyro drift
        self.yawOffset = 0.0
        self.preYaw = 0.0

        # ASL offset
        self.groundLevel = 0.0 # ground level (offset from gui)
        self.preAsl = 0.0      # previous asl value
        self.aslOffset = 0.0   # offset from other barometer

        # If we should spam ROS messages or not
        self.pubRos = True 
開發者ID:omwdunkley,項目名稱:crazyflieROS,代碼行數:43,代碼來源:logManager.py

示例14: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def __init__(self, parent):
        super(Tracker, self).__init__(parent)
        self.name = self.__class__.__name__

        # Ros Stuff
        self.sub_tf = parent.sub_tf
        self.pub_tf = parent.pub_tf

        # Timer that checks if we have failed to start
        self.timer = QTimer()
        self.timer.setSingleShot(True)
        self.timer.timeout.connect(self.failed)
        self.timeout = 2000 #ms
        self.timer.setInterval(self.timeout) 
開發者ID:omwdunkley,項目名稱:crazyflieROS,代碼行數:16,代碼來源:trackManager.py

示例15: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QTimer [as 別名]
def __init__(self,parent=None):
        super(QtCore.QObject, self).__init__(parent)

        pygame.init() #Do we need this? Or is it done already elsewhere
        pygame.camera.init()

        self.cam = None
        self.buffer = None
        self.size = (1280, 720)


        # Get new image from camera at cam fps
        self.camTimer = QtCore.QTimer(self)
        self.camTimer.timeout.connect(self.emitNextFrame) 
開發者ID:omwdunkley,項目名稱:crazyflieROS,代碼行數:16,代碼來源:cameraInput.py


注:本文中的PyQt4.QtCore.QTimer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。