def init(self): self.pos = ((2380, 129), (2500, 59), (1380, 89), (3780, 109), (580, 139), (680, 239), (790, 259), (760, 150), (790, 150), (2930, 159), (590, 80), (530, 60), (1900, 259), (2660, 150), (1540, 90), (810, 220), (860, 320), (740, 180), (820, 128), (490, 170), (700, 230)) self.naliens = len(self.pos) self.scene = QtGui.QGraphicsScene() self.craft = Craft() self.scene.addItem(self.craft) self.setScene(self.scene) for i in range(len(self.pos)): alien = Alien(self.pos[i][0], self.pos[i][1]) self.scene.addItem(alien) text = "Aliens Left: {0}".format(self.naliens) self.score = self.scene.addText(text) self.score.setPos(15, 15) self.score.setDefaultTextColor(QtCore.Qt.white) self.timer = QtCore.QBasicTimer() self.timer.start(DELAY, self)
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle(_(u'Veuillez patienter')) self.setModal(True) self.label = QtGui.QLabel() movie = QtGui.QMovie (os.path.join(iconPrefix,'loading.gif')) self.m = QtGui.QLabel() self.m.setMovie(movie) self.timer = QtCore.QBasicTimer() posit = QtGui.QGridLayout() posit.addWidget(self.m, 0, 0,QtCore.Qt.AlignCenter) posit.addWidget(self.label, 1, 0,QtCore.Qt.AlignCenter) movie.start () self.setLayout(posit) self.toServerQueue = Queue.Queue(0) self.fromServerQueue = Queue.Queue(0) Worker(self.toServerQueue,self.fromServerQueue).start() # start a worker
def __init__(self, lib, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.lib = lib self.initEventMethods() ######yj test self.testGPIO() self.refresh_GUI() self.timer = QtCore.QBasicTimer() self.func()
def __init__(self, parent=None): super(View, self).__init__(parent) self.promptLength = 0 self.__startOfInput = 0 self.setUndoRedoEnabled(False) self.setAcceptRichText(False) self.setContextMenuPolicy(QtCore.Qt.NoContextMenu) self.tripleClickTimer = QtCore.QBasicTimer() self.tripleClickPoint = QtCore.QPoint() self._ignoreKeyPresses = True
def initUI(self): self.lcd = QtGui.QLCDNumber(self) box = QtGui.QVBoxLayout() box.addWidget(self.lcd) self.setLayout(box) self.setGeometry(300, 300, 290, 150) self.time = 0 self.timer = QtCore.QBasicTimer() self.timer.start(1000, self) self.show()
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.empty = True self.emptying = False self.shapes = [] self.timer = QtCore.QBasicTimer() self.enableUpdates() self.setBackgroundRole(QtGui.QPalette.Base) self.setMouseTracking(True)
def __init__(self, parent, *args): QPlainTextEdit.__init__(self, *args) self.parent = parent self.config_main = self.parent.config_main self.config_theme = self.parent.config_theme self.tools = self.parent.tools self.lvars = self.parent.lvars self._loaded = False self.setFrameStyle(QFrame.NoFrame) self.setLineWrapMode(QPlainTextEdit.NoWrap) self._setup_ui() self._casts_marked = False self._casts_selections = None self.cursorPositionChanged.connect( self._on_cursor_position_changed) self._bracket_info = hrdev_plugin.include.helper.AttributeDict() self._bracket_info.saved_bracket = None self._bracket_info.depth = 0 self._bracket_info.seeking_nl = False self._bracket_info.open_brackets = ['[', '{', '('] self._bracket_info.closed_brackets = [']', '}', ')'] self._bracket_info.pairs_closed = {']': '[', '}': '{', ')': '('} self._bracket_info.pairs_open = {'[': ']', '{': '}', '(': ')'} self._bracket_info.ignore_stack_left = [] self._bracket_info.ignore_stack_right = [] self._left_selected_bracket = QTextEdit.ExtraSelection() self._right_selected_bracket = QTextEdit.ExtraSelection() toolTipWidget = QtGui.QLabel() toolTipWidget.setStyleSheet( "QLabel { background-color : #ffffcc; color : #222; padding: 5px; }" ) toolTipWidget.setFrameShape(QtGui.QFrame.StyledPanel) toolTipWidget.setWindowFlags(QtCore.Qt.ToolTip) toolTipWidget.setAttribute(QtCore.Qt.WA_TransparentForMouseEvents) toolTipWidget.hide() self._toolTipWidget = toolTipWidget self._timer = QtCore.QBasicTimer() self._timer.start(2000, self) self._min_marker_len = self.config_main.getint( 'editor', 'min_marker_len') return
def __init__(self,lib,parent=None): super(MainWindow,self).__init__(parent) self.setupUi(self) self.lib=lib self.count = 0 self.stop = 0 self.initEventMethods() self.testGPIO() ######yj test self.refresh_GUI() self.timer = QtCore.QBasicTimer() self.timer.start(1000,self) QtCore.QObject.connect(self.actionLoad, QtCore.SIGNAL("triggered()"), self.load_window) QtCore.QObject.connect(self.actionExit, QtCore.SIGNAL("triggered()"), self.the_end)
def initUI(self): img_path = os.path.dirname( os.path.abspath(inspect.getfile( inspect.currentframe()))) + "/../images/crosshair.jpg" rospy.loginfo("initUI img_path: %s" % img_path) self.statusBar() self.setStyleSheet("QMainWindow { border-image: url(%s); }" % img_path) self.setGeometry(0, 600, 200, 200) self.setWindowTitle('Virtual Joystick') self.show() self.timer = QtCore.QBasicTimer() self.statusBar().showMessage('started')
def __init__(self, parent=None): super(WigglyWidget, self).__init__(parent) self.setBackgroundRole(QtGui.QPalette.Midlight) self.setAutoFillBackground(True) newFont = self.font() newFont.setPointSize(newFont.pointSize() + 20) self.setFont(newFont) self.timer = QtCore.QBasicTimer() self.text = '' self.step = 0; self.timer.start(60, self)
def initUI(self): self.pbar = QtGui.QProgressBar(self) self.pbar.setGeometry(30, 40, 200, 25) self.btn = QtGui.QPushButton('Start', self) self.btn.move(40, 80) self.btn.clicked.connect(self.doAction) self.timer = QtCore.QBasicTimer() self.step = 0 self.setGeometry(300, 300, 280, 170) self.setWindowTitle('QtGui.QProgressBar') self.show()
def initUI(self): self.pbar = QtGui.QProgressBar(self) self.pbar.setGeometry(30, 40, 200, 25) self.button = QtGui.QPushButton('Start', self) self.button.setFocusPolicy(QtCore.Qt.NoFocus) self.button.move(40, 80) self.connect(self.button, QtCore.SIGNAL('clicked()'), self.doAction) self.timer = QtCore.QBasicTimer() self.step = 0 self.setWindowTitle('ProgressBar') self.setGeometry(300, 300, 250, 150)
def __init__(self, boxsize=40): super(Maze, self).__init__() self.speed = 500 self.boxsize = boxsize self.screenheight = int( math.floor(self.contentsRect().height() / self.boxsize)) self.screenwidth = int( math.floor(self.contentsRect().width() / self.boxsize)) self.white = self.palette().color(QPalette.Active, QPalette.Window) self.search = True self.maze = [] self.robot = Robot(self) self.end_location = Location(self.screenwidth - 1, self.screenheight) # Initialise self.timer = QtCore.QBasicTimer() self.build_maze() self.initUI()
def __init__(self, parent): super(Board, self).__init__() self.timer = QtCore.QBasicTimer() self.isWaitingAfterLine = False self.curPiece = Shape() self.nextPiece = Shape() self.curX = 0 self.curY = 0 self.numLinesRemoved = 0 self.board = [] self.setFocusPolicy(QtCore.Qt.StrongFocus) self.isStarted = False self.isPaused = False self.clearBoard() self.c = Communicate() self.nextPiece.setRandomShape()
def __init__(self, list_nodes, proj_conf, path='.'): super(Example, self).__init__() self.temp_data = { #a_node : MIN_TEMPERATURE + (MAX_TEMPERATURE - MIN_TEMPERATURE) / 2 + 1 a_node: MIN_TEMPERATURE for a_node in list_nodes } self.bee_activity_data = {a_node: 0.0 for a_node in list_nodes} if proj_conf is not None: self.node_listener = consumer_IB.BeeArenaListener(proj_conf, path, verb=False, logfile=None) self.node_listener.start_rx() else: self.node_listener = None self.initUI() self.timer = QtCore.QBasicTimer() self.timer.start(SPEED, self) self.counter = 0
def WidgetsParte2_2(self): self.progreso = QtGui.QProgressBar(self) self.progreso.setGeometry(30, 40, 200, 25) self.btn = QtGui.QPushButton('Comenzar', self) self.btn.move(40, 80) self.btn.clicked.connect(self.empieza) self.timer = QtCore.QBasicTimer() self.paso = 0 vbox = QtGui.QVBoxLayout() vbox.addWidget(self.progreso) vbox.addWidget(self.btn) self.setLayout(vbox) self.setGeometry(300, 300, 300, 150) self.setWindowTitle('Ejemplo de widget N°2') self.show()
def __init__(self): super(Example, self).__init__() self.pbar = QtGui.QProgressBar(self) self.pbar.setGeometry(0, 0, 200, 25) self.pbar.setMaximum(100) self.pbar.setMinimum(0) self.button = QtGui.QPushButton('Start', self) self.button.setFocusPolicy(QtCore.Qt.NoFocus) self.button.move(40, 80) self.connect(self.button, QtCore.SIGNAL('clicked()'), self.doAction) self.timer = QtCore.QBasicTimer() self.step = 0 self.setWindowTitle('ProgressBar') self.setGeometry(300, 300, 250, 150) self.show()
def __init__(self, parent=None): super(TetrixBoard, self).__init__(parent) self.timer = QtCore.QBasicTimer() self.nextPieceLabel = None self.isWaitingAfterLine = False self.curPiece = TetrixPiece() self.nextPiece = TetrixPiece() self.curX = 0 self.curY = 0 self.numLinesRemoved = 0 self.numPiecesDropped = 0 self.score = 0 self.level = 0 self.board = None self.setFrameStyle(QtGui.QFrame.Panel | QtGui.QFrame.Sunken) self.setFocusPolicy(QtCore.Qt.StrongFocus) self.isStarted = False self.isPaused = False self.clearBoard() self.nextPiece.setRandomShape()
def initGame(self): self.left = False self.right = True self.up = False self.down = False self.in_game = True self.dots = 3 for i in range(self.dots): x[i] = 50 - i * 10 y[i] = 50 try: self.ball = QtGui.QImage('./dot.png') self.apple = QtGui.QImage('./apple.png') self.head = QtGui.QImage('./head.png') except Exception as error: print error sys.exit(1) self.locateApple() self.timer = QtCore.QBasicTimer() self.timer.start(DELAY, self)
def initUI(self): self.setWindowTitle(u'Informática Gráfica: Generador de Seres.') self.setMaximumSize(500, 620) self.setMinimumSize(500, 620) ###################################################################### center = QtGui.QWidget() self.setCentralWidget(center) ################### Barra ########################################## self.bar = QtGui.QProgressBar(self) self.bar.setGeometry(3, 4, 2, 2) self.timer = QtCore.QBasicTimer() self.step = 0 ################### Parámetros ########################################## self.labelStretch = QtGui.QLabel(u'') self.labelTam = QtGui.QLabel(u'Size:') self.comboboxTam = QtGui.QComboBox() listTam = ['small', 'medium', 'big'] self.comboboxTam.addItems(listTam) self.comboboxTam.currentIndexChanged[int].connect(self.imageTam) self.labelBody = QtGui.QLabel(u'Faction:') self.comboboxBody = QtGui.QComboBox() listBody = ['Arturitos', 'Cethispios'] self.comboboxBody.addItems(listBody) self.comboboxBody.currentIndexChanged[int].connect(self.imageBody) self.labelLeg = QtGui.QLabel(u'Leg length:') self.comboboxLeg = QtGui.QComboBox() listLeg = ['short', 'medium', 'large'] self.comboboxLeg.addItems(listLeg) self.comboboxLeg.currentIndexChanged[int].connect(self.imageLeg) self.labelGround = QtGui.QLabel(u'Ground Type:') self.comboboxGround = QtGui.QComboBox() listGround = ['soft', 'medium', 'hard'] self.comboboxGround.addItems(listGround) self.comboboxGround.currentIndexChanged[int].connect(self.imageGround) self.labelPos = QtGui.QLabel(u'Mode:') self.comboboxPos = QtGui.QComboBox() listPos = [ 'normal', 'defense0', 'defense1', 'defense2', 'attack0', 'attack1', 'attack2' ] #6 self.comboboxPos.addItems(listPos) self.comboboxPos.currentIndexChanged[int].connect(self.imageMode) self.labelTail = QtGui.QLabel(u'Tail:') self.comboboxTail = QtGui.QComboBox() listTail = ['1', '3'] self.comboboxTail.addItems(listTail) self.comboboxTail.currentIndexChanged[int].connect(self.imageTail) self.button = QtGui.QPushButton('Create') self.buttonRandom = QtGui.QPushButton('Random Create') self.pix = QtGui.QLabel(self) self.pix.setPixmap( QtGui.QPixmap(os.path.join(os.getcwd(), 'images/medium.png'))) self.pix.setGeometry(160, 40, 80, 30) self.pix1 = QtGui.QLabel(self) self.pix1.setPixmap( QtGui.QPixmap(os.path.join(os.getcwd(), 'images/bodyround.png'))) self.pix1.setGeometry(160, 40, 80, 30) self.pix2 = QtGui.QLabel(self) self.pix2.setPixmap( QtGui.QPixmap(os.path.join(os.getcwd(), 'images/legshort.png'))) self.pix2.setGeometry(160, 40, 80, 30) self.pix3 = QtGui.QLabel(self) self.pix3.setPixmap( QtGui.QPixmap(os.path.join(os.getcwd(), 'images/soft.png'))) self.pix3.setGeometry(160, 40, 80, 30) self.pix4 = QtGui.QLabel(self) self.pix4.setPixmap( QtGui.QPixmap(os.path.join(os.getcwd(), 'images/normal.png'))) self.pix4.setGeometry(160, 40, 80, 30) self.pix5 = QtGui.QLabel(self) self.pix5.setPixmap( QtGui.QPixmap(os.path.join(os.getcwd(), 'images/1.png'))) self.pix5.setGeometry(160, 40, 80, 30) self.faction = 0 grid = QtGui.QGridLayout() labelBox = QtGui.QVBoxLayout() comboBox = QtGui.QVBoxLayout() imageBox = QtGui.QVBoxLayout() #grid.setColumnStretch(1,0) labelBox.addWidget(self.labelBody) comboBox.addWidget(self.comboboxBody) imageBox.addWidget(self.pix1) labelBox.addWidget(self.labelPos) comboBox.addWidget(self.comboboxPos) imageBox.addWidget(self.pix4) labelBox.addWidget(self.labelTam) comboBox.addWidget(self.comboboxTam) imageBox.addWidget(self.pix) labelBox.addWidget(self.labelLeg) comboBox.addWidget(self.comboboxLeg) imageBox.addWidget(self.pix2) labelBox.addWidget(self.labelGround) comboBox.addWidget(self.comboboxGround) imageBox.addWidget(self.pix3) labelBox.addWidget(self.labelTail) comboBox.addWidget(self.comboboxTail) imageBox.addWidget(self.pix5) #grid.addWidget(self.labelStretch,0,1,0,8) grid.addWidget(self.button, 9, 1, 1, 5) grid.addWidget(self.buttonRandom, 8, 1, 1, 5) grid.addLayout(imageBox, 2, 5) grid.addLayout(labelBox, 2, 1, 2, 1, 1) grid.addLayout(comboBox, 2, 2, 2, 3) grid.addWidget(self.bar, 10, 1, 1, 3) center.setLayout(grid) self.button.clicked.connect(self.generateMonster) self.buttonRandom.clicked.connect(self.randomMonster) exitAction = QtGui.QAction('Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.triggered.connect(self.close) aboutAction = QtGui.QAction('About', self) self.connect(aboutAction, QtCore.SIGNAL("triggered()"), self.about) menubar = self.menuBar() fileAbout = menubar.addMenu('&Help') fileAbout.addAction(aboutAction) fileAbout.addAction(exitAction) self.show()