当前位置: 首页>>代码示例>>Python>>正文


Python gui.MainWindow类代码示例

本文整理汇总了Python中gui.MainWindow的典型用法代码示例。如果您正苦于以下问题:Python MainWindow类的具体用法?Python MainWindow怎么用?Python MainWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MainWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():

  app = QtGui.QApplication(sys.argv)
  app_window = MainWindow(display_width,display_height)
  app_window.show()

  app.exec_()
开发者ID:mtb-beta,项目名称:melody_catcher,代码行数:7,代码来源:melody_catcher.py

示例2: main

def main():
    # create the Application
    app = QtWidgets.QApplication(sys.argv)

    # create the event loop
    event_loop = QEventLoop(app)
    asyncio.set_event_loop(event_loop)

    # Create the Gui
    main_window = MainWindow()
    # plugins to include different websites (and listeners?)
    plugin_manager = PluginManager()
    plugin_manager.register_main_window(main_window)

    # User Settings
    settings_manager = SettingsManager()
    settings_manager.register_main_window(main_window)
    settings_manager.register_plugin_manager(plugin_manager)

    main_window.show()
    try:
        event_loop.run_forever()
    except KeyboardInterrupt:
        pass
    app.deleteLater()
    plugin_manager.terminate_plugins()
    event_loop.close()
    sys.exit()
开发者ID:ChunHungLiu,项目名称:CHATIMUSMAXIMUS,代码行数:28,代码来源:__main__.py

示例3: main

def main():
    """
    Main function for the program
    """
    parser = argparse.ArgumentParser(
        description="Loop a video between 2 points in time based on rules in "
                    "a text file."
    )
    parser.add_argument('timestamp_filename', metavar='F', nargs='?',
                        help='the location of the timestamp file')
    parser.add_argument('--video_filename', metavar='V',
                        help='the location of the video file')
    args = parser.parse_args()
    app = QApplication(sys.argv)
    with open("gui/application.qss", "r") as theme_file:
        app.setStyleSheet(theme_file.read())
    main_window = MainWindow()

    if args.timestamp_filename:
        timestamp_filename = os.path.abspath(args.timestamp_filename)
        main_window.set_timestamp_filename(timestamp_filename)
    if args.video_filename:
        video_filename = os.path.abspath(args.video_filename)
        main_window.set_video_filename(video_filename)

    sys.exit(app.exec_())
开发者ID:dangmai,项目名称:looper,代码行数:26,代码来源:main.py

示例4: main

def main(argv):
    check_pyopenssl_version()
    options = None
    app = QApplication(sys.argv)
    ui = MainWindow(options)
    ui.setWindowTitle('MitmUI v0.1')
    ui.show()
    sys.exit(app.exec_())
开发者ID:karnex47,项目名称:mitm-ui,代码行数:8,代码来源:MitmUI.py

示例5: main

def main():

    app = QApplication(sys.argv)


    args = app.arguments()

    args = map(str, args)

    if platform.system() == 'Windows' and 'python' in args[0]:
        args = args[1:]

    config = parse_args(args[1:])

    if config['verbose'] > 0:
        logging.basicConfig(level=logging.DEBUG)

    win = MainWindow(config)

    win.setFixedSize(600, 400)
    win.setWindowTitle('BrytonOffline')
    win.setWindowIcon(QIcon(resource_path('img/bryton_logo.jpg')))
    win.show()

    return app.exec_()
开发者ID:Pitmairen,项目名称:bryton-offline,代码行数:25,代码来源:main.py

示例6: __init__

    def __init__(self, queue):
        MainWindow.__init__(self, None)
        self.workQueue = queue

        # set up address events
        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.enableAddrButtons, self.addrList)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.disableAddrButtons, self.addrList)

        # set up timer to check connection
        # and update balance
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.update, self.timer)
        self.timer.Start(0)
开发者ID:skeate,项目名称:advbtc,代码行数:13,代码来源:guiEx.py

示例7: main

def main():
    """
    Start the program
    """

    # Initialize the backend
    hardware = Hardware("config/hardware.json")

    # Initialize the GUI
    app = QtGui.QApplication(sys.argv)
    window = MainWindow(hardware)

    # Start
    window.show()
    sys.exit(app.exec_())
开发者ID:bwwyyy,项目名称:hardware-traffic-generator,代码行数:15,代码来源:generator_gui.py

示例8: loop

def loop(HOST, PORT, CERT):

	server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
	server.connect((HOST, PORT))

	buffer = []
	disconnected = False

	# The following code explains how to use the GUI.
	w = MainWindow()
	# update() returns false when the user quits or presses escape.
	while w.update():

		if disconnected:
			continue

		try:
			rready, wready, xready = select.select([server], [server], [server])

			# ready to receive
			if server in rready:
				data = server.recv(1024)
				if not data:
					server.close()
					w.writeln("<server disconnected>")
					disconnected = True
					continue

				# print message
				w.writeln(data.rstrip())

			# ready to send
			if server in wready:
				if len(buffer) > 0:
					server.sendall(buffer.pop())

			# error
			if server in xready:
				server.close()
				sys.exit(1)

			# if the user entered a line getline() returns a string.
			line = w.getline()
			if line:
				buffer.append(line)
				w.writeln("> " + line)

		# close server on SIGINT
		except (KeyboardInterrupt, SystemExit):
			print "\nDisconnecting..."
			server.close()
			print "Cheers!"
			sys.exit(0)
开发者ID:Lapixx,项目名称:CS-UvA-NS2B,代码行数:53,代码来源:lab2b_client_Kersjes_T.py

示例9: main

def main(path=None, page=None):
    """Run the normal interface."""
    app = QtGui.QApplication(sys.argv)
    if path is not None:
        config.settings.Main.Package = path
    window = MainWindow()
    if page is not None:
        window.set_page(page)

    center_window(window)
    window.show()
    warn.set_warnings_qt()
    exit_code = app.exec_()

    prepare_quit(window)

    return exit_code
开发者ID:3D1T0R,项目名称:PortableApps.com-DevelopmentToolkit,代码行数:17,代码来源:main.py

示例10: main

def main(mcast_addr,
	sensor_pos, sensor_range, sensor_val,
	grid_size, ping_period):
	"""
	mcast_addr: udp multicast (ip, port) tuple.
	sensor_pos: (x,y) sensor position tuple.
	sensor_range: range of the sensor ping (radius).
	sensor_val: sensor value.
	grid_size: length of the  of the grid (which is always square).
	ping_period: time in seconds between multicast pings.
	"""
	
	# -- make the gui --
	window = MainWindow()
	
	# -- make the node --
	node = Node(mcast_addr, sensor_pos,sensor_range, sensor_val, window)
	
	start_time = time.time()


	# -- This is the event loop. --
	while window.update():
		node.updateSelect()
		
		# Auto ping
		if (time.time() - start_time) > ping_period:
			node.sendPing()
			start_time = time.time()


		# Check for new messages
		for c in node.readable:
			# Receive message from server and write to the window
			data = c.recvfrom(1024)
			parseData(data, node)
		
		# Check if something was entered in the GUI, parse the input and execute the corresponding command
		line = window.getline()
		if line:
			parseInput(line, node)
	
		# # Prevent busy looping
		time.sleep(0.1)
开发者ID:JeroenVranken,项目名称:lab5,代码行数:44,代码来源:mainFunction.py

示例11: main

def main(mcast_addr,
	sensor_pos, sensor_range, sensor_val,
	grid_size, ping_period):
	"""
	mcast_addr: udp multicast (ip, port) tuple.
	sensor_pos: (x,y) sensor position tuple.
	sensor_range: range of the sensor ping (radius).
	sensor_val: sensor value.
	grid_size: length of the  of the grid (which is always square).
	ping_period: time in seconds between multicast pings.
	"""
	node = nodeContainer()
	# -- make sockets
	node.init(mcast_addr)
	# -- set node values
	node.position = sensor_pos
	node.range = sensor_range
	node.value = sensor_val
	node.pingTime = ping_period
	# -- create gui
	window = MainWindow()
	node.setWindow(window)
	# -- Command/message parser
	parser = msgParser(node)
	# -- Both peer and Mcast connections
	conns = node.getConnections()

	# -- This is the event loop
	while window.update():
		inputReady, outputReady, errorReady = \
			select.select(conns, [], [], 0.025)
		# Is it ping time already
		node.autoPing()

		# Network message
		for s in inputReady:
			parser.parseSensorMessage(s)

		# Gui message
		line = window.getline()
		if line:
			parser.parseLine(line);
开发者ID:blackshadev,项目名称:HWlinkTV,代码行数:42,代码来源:lab5-yourname.py

示例12: main

def main():
    win = MainWindow()
    
    win.setup()
    
    win.set_size_request(600,500)
    win.show_all()
    
    gtk.gdk.threads_init()
    gtk.main()
开发者ID:kinow,项目名称:xmlrpc-ic,代码行数:10,代码来源:__init__.py

示例13: main

def main():
    # create the GUI
    app = QtWidgets.QApplication(sys.argv)

    # create the event loop
    event_loop = QEventLoop(app)
    asyncio.set_event_loop(event_loop)

    main_window = MainWindow()

    # need chat_slot to be able to add to add the chat signal
    chat_slot = main_window.central_widget.message_area.chat_slot

    settings = get_settings_helper()
    # this methods also handles passing in values to websites
    plugin_manager = instantiate_plugin_manager(settings)
    main_window.set_settings(settings)
    chat_list = plugin_manager.get_instances()

    # connect the sockets signals to the GUI
    for chat in chat_list:
        chat.chat_signal.connect(chat_slot)
        chat.connected_signal.connect(main_window.status_bar.set_widget_status)

    listener_interface = pluginmanager.PluginInterface()
    listener_interface.collect_plugins(plugins)

    listener_list = listener_interface.get_instances()  # flake8: noqa
    # main_window.central_widget.message_area.listeners = listener_list

    main_window.show()
    try:
        event_loop.run_forever()
    except KeyboardInterrupt:
        pass
    for chat in chat_list:
        if chat.process:
            chat.process.terminate()
    event_loop.close()
    sys.exit()
开发者ID:AyberkHalac,项目名称:CHATIMUSMAXIMUS,代码行数:40,代码来源:__main__.py

示例14: main

def main():
    # create the Application
    app = QtWidgets.QApplication(sys.argv)

    # create the event loop
    event_loop = QEventLoop(app)
    asyncio.set_event_loop(event_loop)

    # Create the Gui
    main_window = MainWindow()
    # plugins to include different websites (and listeners?)
    plugin_manager = PluginManager()
    plugin_manager.register_main_window(main_window)

    # User Settings
    settings_manager = SettingsManager()
    settings_manager.register_main_window(main_window)
    settings_manager.register_plugin_manager(plugin_manager)


    # listeners handeled separatly for now
    listener_interface = pluginmanager.PluginInterface()
    listener_interface.collect_plugins(plugins)

    listener_list = listener_interface.get_instances()  # flake8: noqa
    # main_window.central_widget.message_area.listeners = listener_list

    main_window.show()
    try:
        event_loop.run_forever()
    except KeyboardInterrupt:
        pass
    app.deleteLater()
    plugin_manager.terminate_plugins()
    event_loop.close()
    sys.exit()
开发者ID:amit63731,项目名称:CHATIMUSMAXIMUS,代码行数:36,代码来源:__main__.py

示例15: main

def main(mcast_addr,
	sensor_pos, sensor_range, sensor_val,
	grid_size, ping_period):
	"""
	mcast_addr: udp multicast (ip, port) tuple.
	sensor_pos: (x,y) sensor position tuple.
	sensor_range: range of the sensor ping (radius).
	sensor_val: sensor value.
	grid_size: length of the  of the grid (which is always square).
	ping_period: time in seconds between multicast pings.
	"""
	# -- Create the multicast listener socket. --
	mcast = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
	# Sets the socket address as reusable so you can run multiple instances
	# of the program on the same machine at the same time.
	mcast.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
	# Subscribe the socket to multicast messages from the given address.
	mreq = struct.pack('4sl', inet_aton(mcast_addr[0]), INADDR_ANY)
	mcast.setsockopt(IPPROTO_IP, IP_ADD_MEMBERSHIP, mreq)
	if sys.platform == 'win32': # windows special case
		mcast.bind( ('localhost', mcast_addr[1]) )
	else: # should work for everything else
		mcast.bind(mcast_addr)

	# -- Create the peer-to-peer socket. --
	peer = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)
	# Set the socket multicast TTL so it can send multicast messages.
	peer.setsockopt(IPPROTO_IP, IP_MULTICAST_TTL, 5)
	# Bind the socket to a random port.
	if sys.platform == 'win32': # windows special case
		peer.bind( ('localhost', INADDR_ANY) )
	else: # should work for everything else
		peer.bind( ('', INADDR_ANY) )

	# -- make the gui --
	window = MainWindow()
	window.writeln( 'my address is %s:%s' % peer.getsockname() )
	window.writeln( 'my position is (%s, %s)' % sensor_pos )
	window.writeln( 'my sensor value is %s' % sensor_val )

	# -- This is the event loop. --
	while window.update():
		pass
开发者ID:JeroenVranken,项目名称:lab5,代码行数:43,代码来源:lab5-yourname.py


注:本文中的gui.MainWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。