def main(): #send ??? to "active" topics for i in range(1, 10): errors_pub.publish("???") messages_pub.publish("???") sleep(0.2) app = QtGui.QApplication(sys.argv) #gui app init #window object window = Window(None) window.show() #Initialize Window, with disabled objects #Initialize the ROV rov = ROV(window) #init a thread passing window and rov as arguments try: thread.start_new_thread(initAndSend, ( window, rov, )) except: print("Unable to start the commands thread. Exit") sys.exit(-1) #start the gui app n = app.exec_() #when it will be closed, kill other processes and exit os.kill(int(sys.argv[1]), signal.SIGKILL) os.kill(int(sys.argv[2]), signal.SIGKILL) sys.exit(n)
def main(): app = QtGui.QApplication(sys.argv) #gui app init #window object window = Window(None) window.show() #Initialize Window, with disabled objects #init rov object rov = ROV(window) #init a thread passing window object as argument try: thread.start_new_thread(initAndSend, ( window, rov, )) except: print("Unable to start the commands thread. Exit") exit(-1) #start the gui app n = app.exec_() #when it's closed, send stop signal to the ROV rov.sendCommand("SSS") exit(n)
def main(): #set the node name rospy.init_node(NODE.GUI, anonymous=False) app = QtGui.QApplication(sys.argv) #gui app init #window object window = Window(None) window.show() #Initialize Window, with disabled objects #init rov object rov = ROV(window) #init a thread passing window object as argument try: thread.start_new_thread(initAndSend, (window, rov, )) except: print("Unable to start the commands thread. Exit") exit(-1) #start the gui app n=app.exec_() sys.exit(n)
def main(): app = QtGui.QApplication(sys.argv) #gui app init #window object window = Window(None) window.show() #Initialize Window, with disabled objects #Initialize the ROV rov = ROV(window) #init a thread passing window and rov as arguments try: thread.start_new_thread(initAndSend, ( window, rov, )) except: print("Unable to start the commands thread. Exit") sys.exit(-1) #start the gui app n = app.exec_() #when it will be closed, kill other processes and exit os.kill(int(sys.argv[1]), signal.SIGKILL) os.kill(int(sys.argv[2]), signal.SIGKILL) sys.exit(n)
def main(): # Every Qt application must have one instance of QApplication. global APP # Use global to prevent crashing on exit APP = QApplication(sys.argv) window = Window(0, 0, 0) window.show() # Start the Qt event loop. (i.e. make it possible to interact with the gui) sys.exit(APP.exec_())
def main(): # Initializes pygame, window pygame.init() window = pygame.display.set_mode( (globals.SCREEN_WIDTH, globals.SCREEN_HEIGHT)) input_params = Inputs() clock = pygame.time.Clock() app = QApplication(sys.argv) param_win = Window() param_win.show() # Polygon to be controlled by arrows polygon = Polygon(np.array([800, 500]), 30, 3, 10, (255, 255, 255)) space = Space(polygon) while globals.RUN: # Drawing shapes space.draw(window) # Adding force to main polygon if input_params.is_left(): polygon.add_force(np.array([-globals.KEY_FORCE, 0.])) elif input_params.is_right(): polygon.add_force(np.array([globals.KEY_FORCE, 0.])) if input_params.is_up(): polygon.add_force(np.array([0., -globals.KEY_FORCE])) elif input_params.is_down(): polygon.add_force(np.array([0., globals.KEY_FORCE])) # Add shape on left click if input_params.mouse_left_click(): space.add_shape(globals.NEW_SHAPE_TYPE, input_params.mouse_pos, globals.NEW_SHAPE_RADIUS, globals.NEW_SHAPE_MASS, globals.NEW_SHAPE_DEGREE) # Remove shape on right click if input_params.mouse_right_click(): space.remove_shape(input_params.mouse_pos) if input_params.is_clear(): space.shapes = [] clock.tick(globals.FPS) elapsed_time = clock.get_time() # Update shapes in space class for movement, rotarion... space.update(window, elapsed_time) # Check for mouse of keyboard click input_params.update() pygame.display.update() pygame.display.set_caption(str(clock.get_fps())) sys.exit(app.exec_())
data = s.recv(32768) if len(data) > 0: client_socket.send(data) else: break s.close() except socket.error as sock_err: print(os.strerror(sock_err.errno)) print("Connection refused!") if s is not None: s.close() def _is_filtered(self, webserver): for cat in self.webservers_categories: if cat[1]: for f_ws in cat[2]: if f_ws == webserver[-len(f_ws):]: return True return False def on_exit(self): if self.serverSocket is not None: self.serverSocket.close() if __name__ == '__main__': proxy = Proxy() proxy.wait_clients() window = Window(proxy) window.show()
main_window = Window('Quantum Simulation') main_window.add_widget(plot) main_window.add_widget(simulation_speed) main_window.add_widget(potential_scale) measurement_panel = QWidget() measurement_layout = QHBoxLayout(measurement_panel) measurement_layout.addWidget(ObservableWidget(position, state, plot)) measurement_layout.addWidget(ObservableWidget(momentum, state, plot)) measurement_layout.addWidget(ObservableWidget(energy, state, plot)) main_window.add_widget(measurement_panel) # Animation def update_animation(): evolve(simulation_speed.value() / frame_rate) plot.update() timer = QtCore.QTimer() timer.timeout.connect(update_animation) if __name__ == '__main__': import sys if (sys.flags.interactive != 1) or not hasattr(QtCore, 'PYQT_VERSION'): timer.start(1000 // frame_rate) main_window.show() QtGui.QApplication.instance().exec_()
#!/usr/bin/env python3 from chess import Chessboard from gui import Window from gl_data import geometries from PyQt4.QtGui import QApplication import sys if __name__ == "__main__": board = Chessboard() app = QApplication(sys.argv) window = Window(geometries, board) window.show() sys.exit(app.exec_())
import sys from PySide2.QtWidgets import QApplication from PySide2.QtCore import QTranslator, QLocale, QLibraryInfo from gui import Window if __name__ == '__main__': app = QApplication(sys.argv) traductor = QTranslator() traductor.load("qtbase_" + QLocale.system().name(), QLibraryInfo.location(QLibraryInfo.TranslationsPath)) app.installTranslator(traductor) win = Window() win.parent = app win.show() sys.exit(app.exec_())
def main(): app = QApplication([]) win = Window() win.show() sys.exit(app.exec())
def show_window_for_video(idx): nonlocal window if window is not None: window.dispose() window = Window(controllers[idx].name) window.show(640, 480)