def main(): root = Tk() app = Application(master=root) root.title("Morse Coder") root.minsize(950, 250) app.mainloop()
def main(): root = tk.Tk() app = Application(master=root) # Set title and bg root.title("ReadTex") root.configure(background='black') # Create a menu create_menu(root) app.mainloop()
def configure(self): if self.gui is True: root = tk.Tk() root.geometry("500x500") app = Application(master=root) app.mainloop() self.cfg = configparser.ConfigParser() self.cfg.read('settings.ini') self.mode = self.cfg['MODE']['mode']
def active_learning_gui(camera, learner, existing_classes=1): def _process_camera_frame(): camera.grab_next_frame() frame_views = camera.get_current_views() show_frames(frame_views) # You may need to convert the color. color_frame = cv2.cvtColor(frame_views["color"], cv2.COLOR_BGR2RGB) color_frame_pil = Image.fromarray(color_frame, mode='RGB') return color_frame_pil def _predict(): color_frame_pil = _process_camera_frame() y_pred = learner(color_frame_pil).cpu().detach().numpy() w.plot(y_pred[0], clear=True) print(f"pred:{y_pred}") print(f"pred:{np.argmax(y_pred)}") def _train_on_class(class_number): color_frame_pil = _process_camera_frame() print(f"Training on class {class_number}") class_number_pred = learner.teach(color_frame_pil, class_number) class_number_pred = class_number_pred.cpu().detach().numpy() w.plot(class_number_pred[0], clear=True) return class_number_pred app = Application(sys.argv) w = MainWindow(existing_classes=existing_classes, predict_btn_callback=_predict, class_btn_callback_func=_train_on_class, add_class_func=learner.grow_class_size) w.show() sys.exit(app.exec_())
def main(): """ Instantiate the GUI class and start the main loop. """ # Scraper and Driver are initialized inside of Application's __init__ root = tk.Tk() app = Application(root) screen_width = root.winfo_screenwidth() screen_height = root.winfo_screenheight() window_x = int(screen_width / 2 - app.window_width * 0.5) window_y = int(screen_height * 0.1) root.title('IG Downloader - Github/Zelbot') root.geometry(f'{app.window_width}x{app.window_height}' f'+{window_x}+{window_y}') root.configure(background=app.border_color) root.resizable(width=False, height=False) root.mainloop()
GRAPH_AUDIO from gui import Application # GROUP STATES C_GROUP = "C-GROUP" T1_GROUP = "T1-GROUP" T2_GROUP = "T2-GROUP" # Set to C_GROUP, T1_GROUP, or T2_GROUP depending on the test CURRENT_TEST_GROUP = T2_GROUP if __name__ == '__main__': original_names = {C_GROUP: ORIGINAL_NAMES_C, T1_GROUP: ORIGINAL_NAMES_T1, T2_GROUP: ORIGINAL_NAMES_T2}[CURRENT_TEST_GROUP] manipulated_names = {C_GROUP: MANIPULATED_NAMES_C, T1_GROUP: MANIPULATED_NAMES_T1, T2_GROUP: MANIPULATED_NAMES_T2}[CURRENT_TEST_GROUP] # Create an application object app = Application(original_names, manipulated_names, GRAPH_AUDIO) # Activate the main loop app.mainloop() # if the app stops if not app.arduino_interface is None: app.arduino_interface.stop()
#!/usr/bin/python import sys import pluggins from machine.automaton import Automaton from gui import Application if __name__ == '__main__': application = Application() application.run(sys.argv)
import argparse # local module from gui import Application from serial import SerialManager device_port = '/dev/cu.usbserial-AI0443U0' if __name__ == '__main__': parser = argparse.ArgumentParser(description=''' Program to run GUI interface to control arduino device body_vibrator ''') parser.add_argument( '--device_port', help= 'path to USB serial port of arduino, usually under /dev of unix like system' ) args = parser.parse_args() if args.device_port: device_port = args.device_port # set serial manager to manage serial operation serial_manager = SerialManager(device_port=device_port) app = Application(serial_manager=serial_manager) app.title('Body vibrator') app.geometry("300x400") app.mainloop()
def start_gui(): root = tk.Tk() app = Application(master=root) app.mainloop()
# beginning screen for game design from gui import Application from Tkinter import * import hub root = Tk() root.resizable(width=False, height=False) app = Application(master=root) def intro(): # introduction screen allowing user to enter hub app.update_console( 'Welcome to Dimensions. At the start of our story, you wake up on a deserted planet in a world unlike your own. As you slowly regain consciousness, you realize that you are indeed on a different universe than you came from. You take out your portal gun and try to decipher the coordinates; however you can\'t seem to make out where you are. You notice in the distance a dimension hub. The hub may be able to take you home, if your universe is in range.\n\n' ) app.update_buttons([('Enter Hub', start)]) def start(): # allows user to move through hub app.update_console( 'You walk into the dimension hub and gather information on your location. You find out that you are on an abandoned planet in dimension K33, but, unfortunately, you notice your home dimension is not within range. You do have a way of getting home using your portal gun, but its currently out of charge. Luckily, you notice 6 dimensions within range that each have a power crystal you need to recharge it. The only way to get home now is to find those six power crystals and make it home alive.\n\nYou will have to travel through six different universes and interact with the people and environment on each of them. You will have five lives to spare, and each mistake you make will take away one of those lives. Now, make us all proud and get back to your home.\n' ) hub.run(app) app.output.yview_moveto(0.25) app.master.title("Dimensions") app.after(0, intro)
def main(): root = Tk() app = Application(master=root) app.mainloop()
import tkinter as tk from gui import Application from problem import Problem root = tk.Tk() app = Application(root, Problem()) app.mainloop()
# encoding: utf-8 from gui import Application if __name__ == '__main__': app = Application() app.mainloop()
if float(self['lower_bound'].get()) >= float(self['higher_bound'].get()): raise ValueError('Нижняя граница должна быть меньше верхней') if int(self['clusters'].get()) <= 0: raise ValueError('Количество кластеров должно быть положительным числом') if not validate_ip(self['server_ip'].get()): raise ValueError('Введён невалидный IP-адрес') def start_working_thread(self): lower_bound = float(self['lower_bound'].get()) higher_bound = float(self['higher_bound'].get()) cluster_count = int(self['clusters'].get()) formula_to_integrate = self['formula'].get() server_ip = self['server_ip'].get() server_port = int(self['server_port'].get()) method = self['rule'].get() controller = DistributedComputingController( lower_bound, higher_bound, cluster_count=cluster_count, formula=formula_to_integrate, computation_method=rules_mapping[method], ) logging_callback = lambda l: self.app.emit_event('log', l) server = ClusterServer(server_ip, server_port, controller, logging_callback=logging_callback) self.app.thread = threading.Thread(target=server.work) self.app.thread.start() if __name__ == '__main__': app = Application('Сервер', MainServerWindow) app.mainloop()
from gui import Application if __name__ == "__main__": app = Application() pass pass
import tkinter as tk from gui import Application from auth import user_auth from spotipy.oauth2 import SpotifyClientCredentials import spotipy import pprint from utils import search_song #username = input("Enter Spotify Username: "******"ihasplaid") manager = SpotifyClientCredentials(client_id=cid, client_secret=csec) sp = spotipy.Spotify(auth=token) root = tk.Tk() app = Application(master=root, token=token, sp=sp) app.mainloop()
from gui import Application import crawler win = Application() win.run()
def start_display(self): root = tk.Tk() app = Application(master=root) app.mainloop()
'log', 'Запуск клиента вычислений... \n' f'{server_ip}:{server_port}\n\n' ) except Exception as e: messagebox.showwarning('Ошибка при запуске клиента', str(e)) return def validate(self): if not validate_ip(self['server_ip'].get()): raise ValueError('Введён невалидный IP-адрес') def start_working_thread(self): # Получим данные из формы server_ip = self['server_ip'].get() server_port = int(self['server_port'].get()) controller = DistributionComputingClient() # Создадим экземпляр контроллера вычислений # Зададим действие для логгирования (при получении текста l отправить его в виде события 'log' в интерфейс) logging_callback = lambda l: self.app.emit_event('log', l) # Создадим экземпляр клиента вычислений client = ClusterClient(server_ip, server_port, controller, logging_callback=logging_callback) # Запустим вычисления в отдельном потоке self.app.thread = threading.Thread(target=client.work) self.app.thread.start() if __name__ == '__main__': app = Application('Клиент', MainClientWindow) app.mainloop()
import sys from PyQt5.QtWidgets import QApplication from gui import Application app = QApplication(sys.argv) ex = Application() sys.exit(app.exec_())
print(f'{players[player].name} has won the game.\n') # Stop current game break # Check if no more fields are free if board.isDraw(): print('The game has ended in a draw.\n') # Stop current game break # Iterator for going between 0 and 1 def toggleValue(): while True: yield 0 yield 1 if __name__ == "__main__": parser = argparse.ArgumentParser(description='A tic-tac-toe game.') parser.add_argument('-m', '--mode', nargs='?', default='gui') args = parser.parse_args() if args.mode == 'cmd': game() else: root = tk.Tk() app = Application(master=root) app.mainloop()
from gui import Application root = Application() root.mainloop()