def main(): #call create table which creats tables for artists and artworks if doeesn't exist art_work.create_table_artist() art_work.create_table_artwork() #call menu function menu.display_menu()
def main(): """Main Function Refrences all other functions and accepts user input""" db.connect() menu.main_menu() while True: command_main = input("Please choose a menu: ").rstrip() if command_main == "script": menu.display_menu() while True: command_script = input("Enter Command: ").rstrip() if command_script == "main": misc_func.powershell() misc_func.remove_bom() db.logs() elif command_script == "delete": misc_func.delete_disabled() elif command_script == "refresh": misc_func.refresh_list() elif command_script == "disabled": misc_func.get_disabled() elif command_script == "read": misc_func.read_text() elif command_script == "back": menu.main_menu() break continue elif command_main == "query": menu.display_query_menu() while True: command_query = input("Choose a query: ").rstrip() if command_query == "all": print("Filler Text") elif command_query == "os": misc_func.format_select_os() elif command_query == "delete": db.delete_computer() elif command_query == "test": db.test() elif command_query == "back": menu.main_menu() break continue elif command_main == "exit": break else: print("Not a Valid Command") menu.main_menu() db.close() print("The application has closed succesfully")
def main(): # Display Banner banner.banner() # Define Target target = input(Fore.GREEN + "[!] Enter Target IP: ") # Call Helper and Menu Functions file_location = h.dict_file() ssl = h.check_ssl() folder_name = h.create_folder() inp = menu.display_menu() # Start Scan start.start_scan(file_location, folder_name, ssl, target, inp)
def client_hvccc(): # creates a client socket client_socket = socket(AF_INET, SOCK_STREAM) # attaches socket, then connects to server client_socket.connect(ADDRESS) # verification message verf_msg = "HVCCC Job Scheduler" # loops until user disconnects while True: # message sent to the server client_socket.send(verf_msg.encode("utf8")) # message received from server data = client_socket.recv(2048) # print the received message # it will be reversed print("Received from the HVCCC server:", str(data.decode("utf8"))) # goes to user interface menu.display_menu() # ask the client whether he wants to continue ans = input("\nDo you want to continue(y/n) :") if ans == "y": continue else: break # closes the connection client_socket.close()
import sys import mysql.connector import menu import database while True: menu.display_menu() option = int(input()) menu.choose_option(option)
from tkinter import * from menu import display_menu display_menu()
def test_display_menu(): display_menu(curses.initscr(), 1, ['film1', 'film2', 'film3']) display_menu(curses.initscr(), 5, ['film1', 'film2', 'film3']) display_menu(curses.initscr(), 5, ('film1', 'film2', 'film3'))
def main(self, stdscr): stdscr.clear() curses.curs_set(False) curses.start_color() self.stdscr = stdscr menu_r = menu.display_menu(stdscr) if menu_r is None: return elif menu_r == "cont": self.load_game() for i in range(7): curses.init_pair(i+1, i, 7-i) stdscr.clear() if not self.game_loaded: x, y = self.new_level() self.p = Player(self, map, x, y) self.levels.append(self.pack_level()) menu.show_big_msg(stdscr, menu.intro_txt) self.alive = True while self.alive: self.draw() stdscr.refresh() k = stdscr.getkey() if k == 'q': stdscr.addstr(0, 0, "Do you want to quit without saving? [y/n]") if stdscr.getkey() in 'yY': break if k == 'S': return self.save_game() a = {'KEY_UP': self.move_up, 'KEY_DOWN': self.move_down, 'KEY_LEFT': self.move_left, 'KEY_RIGHT': self.move_right, 'h': self.move_left, 'j': self.move_down, 'k': self.move_up, 'l': self.move_right, 'y': self.move_ul, 'u': self.move_ur, 'b': self.move_dl, 'n': self.move_dr, #'i': self.open_inventory, '<': self.level_up, '>': self.level_down, 's': lambda : True, } if k in a: if not a[k](): continue else: if k.lower() in a: r = a[k.lower()]() while r is True: self.act_monsters() self.p.rest() self.draw() r = a[k.lower()]() if r is False: continue else: continue if not self.alive: break self.act_monsters() self.p.rest()
def main(stdscr): curses.curs_set(0) #Set the highlight color curses.init_pair(1, curses.COLOR_BLACK, curses.COLOR_WHITE) #Set the position menu default at the first menu option current_row_index = 0 #Display the main menu list menu.display_menu(stdscr, current_row_index) #Get the stored data from the textfile into the application shopping_list shopping_list = get_shopping_list("shopping_list.txt") while True: #Waiting for any input from user user_key = stdscr.getch() stdscr.clear() #Handling pressed key by the user for navigation if user_key == curses.KEY_UP and current_row_index > 0: current_row_index -= 1 elif user_key == curses.KEY_DOWN and current_row_index < len( menu.menu) - 1: current_row_index += 1 elif user_key == curses.KEY_ENTER or user_key in [10, 13]: stdscr.attron(curses.color_pair(1)) stdscr.addstr(0, 0, f"{(menu.menu[current_row_index]).upper()}") stdscr.attroff(curses.color_pair(1)) stdscr.refresh() #Customisation of each menu selected #View Shopping List option if current_row_index == 0: stdscr.addstr(1, 0, "Hit any key to return to main menu") menu.view_list(stdscr, shopping_list) #Add Item to Shopping List option elif current_row_index == 1: print_instruction(stdscr) stdscr.addstr( 6, 0, "Please type in the item that you want to add into your shopping list.(1 item per line)" ) stdscr.addstr(5, 0, f"Your curent shopping list: {shopping_list}") stdscr.refresh() menu.add_item(shopping_list) stdscr.addstr( menu.height - 1, 0, "The item(s) has been added to the shopping list") #Remove Item from Shopping List option elif current_row_index == 2: print_instruction(stdscr) stdscr.addstr( 6, 0, "Please type in the item that you want to remove from shopping list.(1 item per line)" ) stdscr.addstr(5, 0, f"Your curent shopping list: {shopping_list}") stdscr.refresh() menu.remove_item(stdscr, shopping_list) #Clear Shopping List option elif current_row_index == 3: stdscr.addstr(1, 0, "Hit any key to return to main menu") menu.clear_shopping_list(stdscr, shopping_list) # Exit option elif current_row_index == len(menu.menu) - 1: update_shopping_list("shopping_list.txt", shopping_list) sys.exit() #pressed any key stdscr.getch() #return back to menu list menu.display_menu(stdscr, current_row_index) stdscr.refresh()
Label(root, text='备注: ').grid(row=1, column=0) Label(root, textvariable=remark, wraplength=300, justify=LEFT, font=('Helvetica', '9', 'normal')).grid(row=1, column=1, columnspan=4, sticky=W) # 第二行:下划线 Canvas(root, bg='black', height=1, width=600).grid(row=2, column=0, columnspan=5, pady=10) # 第三行:文件导入标签、输入框、文件导入按钮 import_path = StringVar() # output_path = StringVar() Label(root, text="导入文件路径:").grid(row=3, column=0, pady=10) ety_import = Entry(root, textvariable=import_path, width=50) ety_import.grid(row=3, column=1, columnspan=3, pady=10) btn_import = Button(root, text="路径选择", command=lambda: select_import_path(import_path)) btn_import.grid(row=3, column=4, pady=10) # 第四行:计算按钮 btn_calc = Button(root, text="计算", width=40, command=lambda: calc(ety_import.get())) btn_calc.grid(row=4, column=0, columnspan=5, pady=20) # 进度条以及完成程度 progress_bar = Progressbar(root, length=350, mode="determinate", orient=HORIZONTAL) progress_bar["maximum"] = 100 progress_bar["value"] = 0 progress_bar.grid(row=5, columnspan=5) menubar = display_menu(root, select_list) # 展示菜单 root.config(menu=menubar) root.mainloop()
def main(): """sets up tables if necessary and sets up menu to continue to pop up until user hits Q """ artwork_db.create_tables() while True: menu.display_menu()
def main(self, stdscr): stdscr.clear() curses.curs_set(False) curses.start_color() self.stdscr = stdscr menu_r = menu.display_menu(stdscr) if menu_r is None: return elif menu_r == "cont": self.load_game() for i in range(7): curses.init_pair(i + 1, i, 7 - i) stdscr.clear() if not self.game_loaded: x, y = self.new_level() self.p = Player(self, map, x, y) self.levels.append(self.pack_level()) menu.show_big_msg(stdscr, menu.intro_txt) self.alive = True while self.alive: self.draw() stdscr.refresh() k = stdscr.getkey() if k == 'q': stdscr.addstr(0, 0, "Do you want to quit without saving? [y/n]") if stdscr.getkey() in 'yY': break if k == 'S': return self.save_game() a = { 'KEY_UP': self.move_up, 'KEY_DOWN': self.move_down, 'KEY_LEFT': self.move_left, 'KEY_RIGHT': self.move_right, 'h': self.move_left, 'j': self.move_down, 'k': self.move_up, 'l': self.move_right, 'y': self.move_ul, 'u': self.move_ur, 'b': self.move_dl, 'n': self.move_dr, #'i': self.open_inventory, '<': self.level_up, '>': self.level_down, 's': lambda: True, } if k in a: if not a[k](): continue else: if k.lower() in a: r = a[k.lower()]() while r is True: self.act_monsters() self.p.rest() self.draw() r = a[k.lower()]() if r is False: continue else: continue if not self.alive: break self.act_monsters() self.p.rest()