本文整理汇总了Python中PyQt5.QtCore.QBasicTimer方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QBasicTimer方法的具体用法?Python QtCore.QBasicTimer怎么用?Python QtCore.QBasicTimer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore
的用法示例。
在下文中一共展示了QtCore.QBasicTimer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QBasicTimer [as 别名]
def initUI(self):
# 块大小
self.grid_size = 22
# 游戏帧率
self.fps = 200
self.timer = QBasicTimer()
# 焦点
self.setFocusPolicy(Qt.StrongFocus)
# 水平布局
layout_horizontal = QHBoxLayout()
self.inner_board = InnerBoard()
self.external_board = ExternalBoard(self, self.grid_size, self.inner_board)
layout_horizontal.addWidget(self.external_board)
self.side_panel = SidePanel(self, self.grid_size, self.inner_board)
layout_horizontal.addWidget(self.side_panel)
self.status_bar = self.statusBar()
self.external_board.score_signal[str].connect(self.status_bar.showMessage)
self.start()
self.center()
self.setWindowTitle('Tetris-公众号:Charles的皮卡丘')
self.show()
self.setFixedSize(self.external_board.width() + self.side_panel.width(),
self.side_panel.height() + self.status_bar.height())
示例2: initUI
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QBasicTimer [as 别名]
def initUI(self):
self.gridSize = 22
self.speed = 10
self.timer = QBasicTimer()
self.setFocusPolicy(Qt.StrongFocus)
hLayout = QHBoxLayout()
self.tboard = Board(self, self.gridSize)
hLayout.addWidget(self.tboard)
self.sidePanel = SidePanel(self, self.gridSize)
hLayout.addWidget(self.sidePanel)
self.statusbar = self.statusBar()
self.tboard.msg2Statusbar[str].connect(self.statusbar.showMessage)
self.start()
self.center()
self.setWindowTitle('Tetris')
self.show()
self.setFixedSize(self.tboard.width() + self.sidePanel.width(),
self.sidePanel.height() + self.statusbar.height())
示例3: __init__
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QBasicTimer [as 别名]
def __init__(self, *args, **kwargs):
super(WidgetCode, self).__init__(*args, **kwargs)
self._sensitive = False # 是否大小写敏感
self.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.setBackgroundRole(QPalette.Midlight)
self.setAutoFillBackground(True)
# 字体
newFont = self.font()
newFont.setPointSize(16)
newFont.setFamily("Kristen ITC")
newFont.setBold(True)
self.setFont(newFont)
self.reset()
# 定时器
self.step = 0
self.timer = QBasicTimer()
self.timer.start(60, self)
示例4: __init__
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QBasicTimer [as 别名]
def __init__(self):
super().__init__()
self.tabs = QTabWidget()
self.com = DeviceComms()
self.setWindowTitle('ratctl - ' + self.com.getCurrentMouseName())
self.pbar = QProgressBar()
self.pbar.setFormat("Battery : %p%")
self.grid = QGridLayout()
self.setLayout(self.grid)
self.grid.addWidget(self.pbar)
self.grid.addWidget(self.tabs)
self.dpi = DPI()
self.t = [] # table of tabs
for i in range(0, 4):
self.t.append(DPIAdjustmentTab(i, self.dpi, self.com))
self.tabs.addTab(self.t[i], "Mode " + str(i + 1))
self.data = Data(self.pbar, self.tabs, self.dpi, self.com)
for i in range(0, 4):
self.t[i].sendButton.clicked.connect(self.data.sendDpi)
self.t[i].resetButton.clicked.connect(self.com.resetDpi)
self.timer = QBasicTimer() # Timer to periodically update information
self.timer.start(100, self.data)
self.tabs.currentChanged.connect(self.com.sendMode) # Changes the mode when changing tabs
self.com.getDpi(self.dpi)
self.dpi.dataHasBeenSent()
示例5: initUI
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QBasicTimer [as 别名]
def initUI(self):
self.pbar = QProgressBar(self)
self.pbar.setGeometry(30, 40, 200, 25)
self.btn = QPushButton('Start', self)
self.btn.move(40, 80)
self.btn.clicked.connect(self.doAction)
self.timer = QBasicTimer()
self.step = 0
self.setGeometry(300, 300, 280, 170)
self.setWindowTitle('QProgressBar')
self.show()
示例6: __init__
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QBasicTimer [as 别名]
def __init__(self, camera_port=0, parent=None):
super().__init__(parent)
self.camera = cv2.VideoCapture(camera_port)
self.timer = QtCore.QBasicTimer()
示例7: __init__
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QBasicTimer [as 别名]
def __init__(self, camera_port=0, parent=None):
super().__init__(parent)
self.camera = cv2.VideoCapture(camera_port)
self.timer = QBasicTimer()
示例8: initUI
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QBasicTimer [as 别名]
def initUI(self):
# 块大小
self.grid_size = 22
# 游戏帧率
self.fps = 100
self.timer = QBasicTimer()
# 焦点
self.setFocusPolicy(Qt.StrongFocus)
# 水平布局
layout_horizontal = QHBoxLayout()
self.inner_board = InnerBoard()
self.external_board = ExternalBoard(self, self.grid_size, self.inner_board)
layout_horizontal.addWidget(self.external_board)
self.side_panel = SidePanel(self, self.grid_size, self.inner_board)
layout_horizontal.addWidget(self.side_panel)
self.status_bar = self.statusBar()
self.external_board.score_signal[str].connect(self.status_bar.showMessage)
self.start()
self.center()
self.setWindowTitle('Tetris-公众号:Charles的皮卡丘')
self.show()
self.setFixedSize(self.external_board.width() + self.side_panel.width(),
self.side_panel.height() + self.status_bar.height())
# AI控制
self.tetris_ai = TetrisAI(self.inner_board)
self.next_action = None
self.pre_tetris = tetrisShape().shape_empty
示例9: initBoard
# 需要导入模块: from PyQt5 import QtCore [as 别名]
# 或者: from PyQt5.QtCore import QBasicTimer [as 别名]
def initBoard(self):
self.timer = QtCore.QBasicTimer()
self.isWaitingAfterLine = False
self.curX = 0
self.curY = 0
self.numLinesRemoved = 0
self.board = []
self.setFocusPolicy(QtCore.Qt.StrongFocus)
self.isStarted = False
self.isPaused = False
self.clearBoard()