def main(): sentence_repository = SentenceRepository("repo.txt") sentence_controller = SentenceController(sentence_repository) ui = UI(sentence_controller) ui.main_menu() sentence_repository.write_file()
def main(): window = Tk() window.geometry("450x400") window.title("Fruity Slots") ui = UI(window) # pylint: disable=invalid-name ui.start() window.mainloop()
def startApp(self): """ Main function for starting the app :return: """ # # with open(self.fileAddresses, "w") as f: # for i in range(10): # f.write(str(Address(i, "Address" + str(i), str(i*3), str(i*4)))) # with open(self.fileDrivers, "w") as f: # for i in range(10): # f.write(str(Driver("Name" + str(i), str(i*5), str(i*6)))) repoAddresses = Repository(self.fileAddresses, Address) repoDrivers = Repository(self.fileDrivers, Driver) while True: UI.printMenu() try: cmd = UI.readCmd() if cmd == 1: UI.printAll(repoAddresses, repoDrivers) if cmd == 2: address = UI.readAddress() listOfDrivers = self.calculateDistance( address, repoDrivers) UI.printList(listOfDrivers) if cmd == 3: pairs = self.getPairOfDrivers(repoDrivers) UI.printPairs(pairs) except Exception as ex: print(ex)
def main(): window = Tk() window.title("Osakeseuranta") ui = UI(window) ui.start() window.mainloop()
def main(): window = Tk() window.title('CipherToolsApp') ui = UI(window) ui.start() window.mainloop()
def main(): window = Tk() window.title("Budjetointisovellus") ui_ui = UI(window) ui_ui.start() window.mainloop()
def main(): root = tk.Tk() root.title("Notation app") root.geometry("1200x800") root.minsize(600, 400) ui = UI(root) ui.show() root.mainloop()
def main(): """Alustellaan tarvittavat kirjastot ja lähdetään ajamaan ohjelmaa """ window = Tk() ui = UI(window) ui.start() window.mainloop()
def main(): window = Tk() window.title('TodoApp') ui = UI(window) ui.start() window.mainloop()
def main(): window = Tk() window.title("Markdown Editor") ui = UI(window) ui.start() window.mainloop()
def main(): window = Tk() window.title("RiddleGen") ui_main = UI(window) ui_main.start() window.mainloop()
def main(): '''creating the window loop for the app''' window = Tk() window.title("Kierrätys") ui = UI(window) ui.start() window.mainloop()
def main(): window = Tk() window.title("Course Tracker Application") ui = UI(window) ui.start() window.mainloop()
def main(): initialize_database() window = Tk() window.title("TÄTI") u_int = UI(window) u_int.start() window.mainloop()
def main(): window = Tk() window.title("Probability quiz") ui = UI(window) ui.start() window.mainloop()
def main(): window = Tk() window.title("Opinnot") ui = UI(window) ui.start() window.mainloop()
def main(): window = Tk() window.title("OTConverter") window.minsize(700, 400) window.resizable(False, False) ui = UI(window) ui.start() window.mainloop()
def __init__(self): self._SAVE_FILE_PATH = 'save.plsf' self._done = False self._event_dispatcher = UserEventDispatcher(self) self._renderer = Renderer(GameSettings.Screen.WIDTH, GameSettings.Screen.HEIGHT) self._timer = GameTimer() self._city = self.load_game() self._ui = UI(self) self._state = NormalState()
def main(): window = Tk() window.title("Zero salt rounds") window.geometry("1200x800") # remove when register is working initialize_db() ui = UI(window) ui.start() window.mainloop()
def run(): ''' Creates the necessary tools for the application to run and starts it ''' repository = Repository() controller = Controller(repository) ui = UI(controller) tester = Test() Test.testAll(tester) ui.mainMenu()
def runProgram(self): """ This method runs the command-based part of the game Receive commands from UI and execute them :return: nothing Catches any exceptions raised during the execution, mostly from UI """ UI.printMenu([]) while True: try: cmd, args = UI.getCommand() self.__cmdDict[cmd](args) except Exception as ex: UI.printException(ex)
def main(): clRepo = readFromFile("clientRepo.pickle") mvRepo = readFromFile("movieRepo.pickle") rtRepo = readFromFile("rentalRepo.pickle") st = store() find = finder(clRepo, mvRepo) undoC = undoController() clc = clientController(clRepo, undoC) mvc = movieController(mvRepo, undoC) rtc = rentalController(rtRepo, clRepo, mvRepo, st, undoC) rmc = removalController(clRepo, mvRepo, rtRepo, undoC, rtc) CL = controller(clc, mvc, rtc, rmc, undoC, find) u = UI(CL) u.start()
def main(): """Call this to start the program. """ window = Tk() window.title("Arithmetician") database = Database() if not database.is_db_connection_ok(): print( f"Failed to connect to database: {Config.DB_FILENAME}. Exiting..") return gui = UI(window, MainService(UserRepository(database))) gui.start() window.geometry("350x500") window.mainloop()
def end_game(player1, player2, match_history, GS): """Sends game information to be saved and calls end game screen. Args: player1: Username for player1. player2: Username for player2. match_history: Match history class. GS: GameState class. """ match_history.add_score(player1, player2, GS.game_result) p.quit() window = Tk() window.title("Chess") ui = UI(window, main, player1, player2) ui.end(GS.game_result) window.mainloop()
def __init__(self, username): """Luokan konstruktori. Luo päävalikon valinnat Args: username: kirjautuneen käyttäjän nimi """ self._actions = { "x": "x Lopeta", "1": "1 Uusi kurssi", "2": "2 Hae kurssit", "3": "3 Poista kurssi", "4": "4 Muuta tietoja", "5": "5 Syötä tenttipäivämäärä", "6": "6 Ilmoittaudu kurssille", "7": "7 Tulevat tenttini" } self._headers = ["Kurssi", "Opintopisteet"] self._ui = UI() self._repository = CourseRepository(get_database_connection()) self._username = username
def worldLoop(window): logger = Logger() # Add room, player, and npc to world level = Level() level.generateLevel() player = Player('TerminusSTC', 100, 100, 'Slytherin', logger) level.addEntityToRoom(player, 'great_hall', [12, 9]) h_student = NPC('student') level.addEntityToRoom(h_student, 'great_hall', [12, 12]) ui = UI(window, player, level, logger) cmd_parser = CmdParser(ui, player, level) while True: ui.render() cmd = ui.getCommand() cmd_parser.parseCmd(cmd)
def main(): """Luo peli-ikkunan ja aloituspainikkeen. """ from ui.ui import UI _win = pygame.display.set_mode((700, 550)) pygame.display.set_caption("Sudoku") _win.fill((38, 38, 38)) _x, _y = (530, 100) _font = pygame.font.SysFont("Arial", 35) _text = _font.render("Uusi peli", 1, "white") pygame.draw.rect(_win, "green", (_x - 10, _y - 10, 155, 60)) _win.blit(_text, (_x, _y)) pygame.display.update() _ui = UI(_win) _ui.start()
def startGame(self): print(self.board) print("Width: " + str(self.board.width)) print("Height: " + str(self.board.height)) print("You: \033[31m" + "RED" + "\033[0m") print("Computer: \033[34m" + "BLUE" + "\033[0m") # print("Choose UI:") # option = None # while True: # try: # option = UI.chooseUI() # break # except Exception as ex: # print(ex) option = 1 if option == 1: while not self.isOver(): if self.isPlayerTurn: column = UI.readPlayerInput(self.board.width) - 1 if not self.board.isAnyDotAvaiable(column): print("There is no dot available in this column!") continue self.board.makeMove(column, Dot(1)) self.isPlayerTurn = False print("Your move on C" + str(column + 1) + ":") print(self.board) else: computer = AIComputer(self.board) column = computer.computeMove() if not self.board.isAnyDotAvaiable(column): print("Computer chose a move that is not available") continue self.board.makeMove(column, Dot(2)) self.isPlayerTurn = True print("Computer made a move on C" + str(column + 1) + ":") print(self.board) if not self.isPlayerTurn: print("Congratulations! You won the game!") else: print( "GAME OVER\nSorry but the computer is way more smarter than you :D" ) print("Game finished!") elif option == 2: root = Tk() handler = UiHandler(root) handler.openUi() root.mainloop()
def main(): """Start the game. Read display size, set title and create classes needed for UI. """ pygame.init() display_info = pygame.display.Info() display_width = display_info.current_w display_heigth = display_info.current_h display = pygame.display.set_mode((display_width, display_heigth)) pygame.display.set_caption(TITLE) audio = AudioService() renderer = Renderer(display, display_width, display_heigth) event_queue = EventQueueService() clock = ClockService(FPS) info = InformationService() user_interface = UI(audio, renderer, event_queue, clock, info) user_interface.start_menu()
def main(): window = Tk() window.title("Ruokalistageneraattori") window.configure(bg="#FFFFEA") if Path(ICON_PATH).is_file(): icon = PhotoImage(file=ICON_PATH) window.tk.call('wm', 'iconphoto', window._w, icon) # pylint: disable=protected-access check = InputOutput().read("SELECT * FROM meals") if not isinstance(check, list): text = "Suorita komento poetry run invoke build ennen ohjelman ensimmäistä käynnistystä!" label = ttk.Label(window, text=text, padding=200) label.pack() else: user_interface = UI(window) user_interface.start() window.mainloop()
def run(): try: #course_repository = RepoCourses() course_repository = CourseFileRepository() #course_repository = CourseRepository() course_controller = CourseController(course_repository) student_repository = StudentFileRepository() #student_repository = StudentRepository() student_controller = StudentController(student_repository) #grade_repository = GradeRepository() grade_repository = GradeFileRepository(course_repository.find_all(), student_repository.find_all()) grade_controller = GradeController(course_repository, student_repository, grade_repository) ui = UI(course_controller, student_controller, grade_controller) ui.run() except ValueError: print("Cannot read file data") except StudentError: print('Cannot read file data')
def __init__(self, first_message=""): """ The construction for the app. Used for reading the bloc from the file """ self.client_repository = FileClientRepository("clients_new.dat") self.movie_repository = FileMovieRepository("movies_new.dat") self.rent_repository = FileRentRepository("rents_new.dat") self.client_controller = ClientController(self.client_repository) self.movie_controller = MovieController(self.movie_repository) self.rent_controller = RentController(rent_repository=self.rent_repository, client_controller=self.client_controller, movie_controller=self.movie_controller) self.ui = UI(self.client_controller, self.movie_controller, self.rent_controller) Session.set_message(first_message)
class App(object): def __init__(self, first_message=""): """ The construction for the app. Used for reading the bloc from the file """ self.client_repository = FileClientRepository("clients_new.dat") self.movie_repository = FileMovieRepository("movies_new.dat") self.rent_repository = FileRentRepository("rents_new.dat") self.client_controller = ClientController(self.client_repository) self.movie_controller = MovieController(self.movie_repository) self.rent_controller = RentController(rent_repository=self.rent_repository, client_controller=self.client_controller, movie_controller=self.movie_controller) self.ui = UI(self.client_controller, self.movie_controller, self.rent_controller) Session.set_message(first_message) def run(self): """ Main loop of the application """ # self.load() self.ui.display_message() self.ui.run() # self.save() self.exit() # def load(self): # """ # Load the previous state # """ # try: # with open("clients.dat", "r") as fp: # self.client_repository._repository = cPickle.load(fp) # except cPickle.UnpicklingError: # pass # except IOError: # pass # # try: # with open("movies.dat", "r") as fp: # self.movie_repository._repository = cPickle.load(fp) # except cPickle.UnpicklingError: # pass # except IOError: # pass # # try: # with open("rents.dat", "r") as fp: # self.rent_repository._repository = cPickle.load(fp) # except cPickle.UnpicklingError: # pass # except IOError: # pass # # def save(self): # """ # Saves the current state # """ # with open("clients.dat", "w") as fp: # cPickle.dump(self.client_repository._repository, fp) # with open("movies.dat", "w") as fp: # cPickle.dump(self.movie_repository._repository, fp) # with open("rents.dat", "w") as fp: # cPickle.dump(self.rent_repository._repository, fp) @staticmethod def exit(): """ Quits the app, called on 'quit' command """ exit("\nBye Bye :)")
#!/usr/bin/python3 """ @author: Daniel Butum, Group 911 """ import sys import tests from ui.ui import UI if __name__ == "__main__": if sys.version_info[0] < 3: sys.exit("ERROR: Must be using at least Python 3") tests.run() ui = UI() ui.run()
''' Created on Nov 11, 2014 @author: horatiu ''' from controller.Catalog import Catalog from repository.StudentRepo import StudentRepo from Validator.StudentValidator import StudentValidator from ui.ui import UI from Validator.SubjectValidator import SubjectValidator from repository.SubjectRepo import SubjectRepo from controller.MarkController import MarkController from repository.MarkRepo import MarkRepo from Validator.MarkValidator import MarkValidator from repository.MarkRepoFile import MarkRepoFile from repository.StudentRepoFile import StudentRepoFile from repository.SubjectRepoFile import SubjectRepoFile stur = StudentRepoFile("students1.txt") sbr = SubjectRepoFile("subjects1.txt") catalog = Catalog(StudentValidator(), stur, SubjectValidator(), sbr) markController = MarkController(MarkValidator(), MarkRepoFile("marks1.txt"), stur, sbr) ui = UI(catalog, markController) ui.startUi()