def __init__(self, app, kind='', icon_file=None, center=True): self.findIcon() Tk.__init__(self) if center: pass self.__app = app self.configBorders(app, kind, icon_file)
def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) container = Frame(self) self.title("3d Printer") #This fied is populated on the first view #and displayed on the second self.customer_id = StringVar() container.pack(side="top", fill="both", expand=True) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} for F in (CreateCustomerView, ExecuteScriptView): frame = F(container, self) self.frames[F] = frame # put all of the pages in the same location; # the one on the top of the stacking order # will be the one that is visible. frame.grid(row=0, column=0, sticky="nsew") self.model = CreateCustomerModel() self.show_frame(CreateCustomerView)
def __init__(self, title="", message="", button="Ok", image=None, checkmessage="", style="clam", **options): """ Create a messagebox with one button and a checkbox below the button: parent: parent of the toplevel window title: message box title message: message box text button: message displayed on the button image: image displayed at the left of the message checkmessage: message displayed next to the checkbox **options: other options to pass to the Toplevel.__init__ method """ Tk.__init__(self, **options) self.resizable(False, False) self.title(title) s = Style(self) s.theme_use(style) if image: Label(self, text=message, wraplength=335, font="Sans 11", compound="left", image=image).grid(row=0, padx=10, pady=(10, 0)) else: Label(self, text=message, wraplength=335, font="Sans 11").grid(row=0, padx=10, pady=(10, 0)) b = Button(self, text=button, command=self.destroy) b.grid(row=2, padx=10, pady=10) self.var = BooleanVar(self) c = Checkbutton(self, text=checkmessage, variable=self.var) c.grid(row=1, padx=10, pady=0, sticky="e") self.grab_set() b.focus_set() self.wait_window(self)
def __init__(self,root): Tk.__init__(self,root) self.root = root self.MAX_F = 12 self.info = StringVar() self.sliders = [] self.parameters = [] self.filters = [] self.isAdvancedMode = False self.isWritting = False self.configFile = "config.xml" self.cw = ConfigWritter(self.configFile) if not isfile(self.configFile): self._createConfigFile() self.cp = ConfigParser(self.configFile) self._parseConfigFile() self.canvas = Canvas() self.canvas.pack(expand=YES,fill=BOTH) self.initialize()
def __init__(self, width, height, cellSize,player=None,logicBoard=None): """ :param width: largeur du plateau :param height: hauteur du plateau :param cellSize: largeur des cases :param player: joueur :param logicBoard: plateau logique (liste de liste) """ Tk.__init__(self) self.cellSize = cellSize self.guiBoard = Canvas(self, width=width, height=height, bg="bisque") self.currentFixedLabel = FixedLabel(self,"CURRENT PLAYER : ",16,0) self.currentVariableLabel = VariableLabel(self,18,0,"string") self.bluePointsFixedLabel = FixedLabel(self,"BLUE CAPTURES : ",16,2) self.bluePointsVariableLabel = VariableLabel(self,18,2,"integer") self.redPointsFixedLabel = FixedLabel(self,"RED CAPTURES : ",16,4) self.redPointsVariableLabel = VariableLabel(self,18,4,"integer") self.logicBoard=logicBoard if not(logicBoard): self.logicBoard=dr.initBoard(DIMENSION) self.player=player if not(player): self.player=1 self.hasPlayed=False self.hasCaptured=False self.guiBoard.bind("<Button -1>", self.bindEvent) self.initiateBoard() self.guiBoard.grid(rowspan=DIMENSION+1,columnspan=DIMENSION+1,row=0,column=4)
def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) self.make_months() self['menu'] = self.make_menu() self.title('Calendar') self.resizable(width=False, height=False) # Change this for different size self.geometry('580x150')
def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) self.container = Frame(self) self.container.pack(side="top", fill="both", expand=True, padx=20, pady=20) self.loadWindow = LoadWindow(self.container, self) self.loadWindow.grid(row=0, column=0, sticky="nesw") self.showLoadWindow()
def __init__(self, geom, colors, browObj=None): Tk.__init__(self) self.geometry(geom) self.resizable(width=False, height=False) self.configure(bg=colors) self.overrideredirect(False) if browObj is None: self.bind('<Escape>', lambda kPress: [self.quit()]) else: self.bind('<Escape>', lambda kPress: [self.quit(), browObj.quit()])
def __init__(self, size, delay, exposure, gain, *args, **kwargs): Tk.__init__(self, *args, **kwargs) self.camera = IndiCamera() self.geometry(f'{size}x{size}') self.delay = delay self.exposure = exposure self.gain = gain self.write_header() self.update_color()
def __init__(self, table_type, file_path, window_size="600x400"): Tk.__init__(self) self.table_type = table_type self.file_path = file_path self.csvfile = CSVWrapper(self.file_path) self.geometry(window_size) self.wm_title(self.title) ScrolledText(self, self.csvfile.text).pack(side='top', fill='both', expand=True)
def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) self.frames = {} for F in (StartPage, PageOne): frame = F(self) self.frames[F] = frame frame.grid(row=0, column=0, sticky="nsew") self.show_frame(StartPage)
def __init__(self, parent, title, geometry=None, max=True): Tk.__init__(self, parent) self.title(title) if geometry is not None: self.geometry(geometry) w, h = geometry.split("x") self.minsize(int(w), int(h)) if max: self.maxsize(int(w), int(h)) self.initialize()
def __init__(self, message, title, window_size="650x150", anchor='center'): Tk.__init__(self) self.wm_title(title) self.message = message self.geometry(window_size) for line in message.split('\n'): Label(self, text=line, font=PYTHON_FONT, anchor=anchor).pack(fill="both", padx=10, expand=False) self.button = Button(self, text="OK", command=self.destroy) self.button.pack(expand=True)
def __init__(self, *args, **kwargs): ''' Конструктор ''' Tk.__init__(self, *args, **kwargs) self.preference_window = None imgicon = PhotoImage(file="calc.png") self.tk.call('wm', 'iconphoto', self._w, imgicon) self.style = CUSTOM_STYLE() self._main_menu() self.main_window = MAIN_WINDOW(self) self.main_window.pack(expand="100", fill="both")
def __init__(self): Tk.__init__(self) self.label = Label(self, text="Stopped.") self.label.pack() self.play_button = Button(self, text="Play", command=self.play) self.play_button.pack(side="left", padx=2, pady=2) self.stop_button = Button(self, text="Stop", command=self.stop) self.stop_button.pack(side="left", padx=2, pady=2) self._thread, self._pause, self._stop = None, False, True
def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) Tk.wm_title(self, 'Contoso University') self.menubar = MainMenu(self) self.config(menu=self.menubar) self.frames = {} self.__init_frames()
def __init__(self): Tk.__init__(self) self.title("") # set_window_center(self, 400, 400) self.app_name = "Python Tkinter Application" # glv.get_variable("APP_NAME") self.app_version = "0.1.1" self.app_desc = "简述简述简述简述简述简述" self.app_url = "https://crogram.com" self.app_ = "Copyright © 2018 Abner. All rights reserved." # self.resizable(False, False) self.init_page()
def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) self.wm_protocol('WM_DELETE_WINDOW', func=self.close_all) self.resize_screen() # self.attributes('zoomed', True) self._init_all_screen() self.navigate("Splash")
def __init__(self): Tk.__init__(self) self.title("") # set_window_center(self, 400, 400) self.app_name = "Doctor's Appointment System" # glv.get_variable("APP_NAME") self.app_version = "0.1.1" self.app_desc = "Brief description" self.app_url = "https://du.ac.com" self.app_ = "Copyright © 2019 MIT, DU. All rights reserved." # self.resizable(False, False) self.init_page()
def __init__(self, *args, **kwargs): """Make boxes, register callbacks etc.""" Tk.__init__(self, *args, **kwargs) self.wm_title("Horoskop") self.geometry("{}x{}".format(window_width, window_height)) self.minsize(window_width, window_height) self.date = DateWidget(self) self.date.pack(pady=medium_pad) self.pred = PredictionWidget(self) self.pred.pack(fill=BOTH, expand=True, padx=big_pad, pady=big_pad) self.date.setListener(self.pred)
def __init__(self): """Le constructeur de l'application instancie la fenêtre, le canevas (la zonde de dessin) et deux boutons. """ # initialisation de la fenêtre Tk.__init__(self) # initialisation de la zone de dessin self.canvas = Canvas(self, width=950, height=260, bg='white') self.canvas.pack(side=TOP, padx=5, pady=5) # ajout des bottons 'Train' et 'Hello Button(self, text="Train", command=self.draw_train).pack(side=LEFT) Button(self, text="Hello", command=self.hello).pack(side=LEFT)
def __init__(self): Tk.__init__(self) self.canvas = Canvas(height=self.WINDOW_SIZE, width=self.WINDOW_SIZE, bg='Black') self.title_screen() self.turn = 'X' self.board = [ ['-', '-', '-'], ['-', '-', '-'], ['-', '-', '-'], ] self.canvas.pack()
def __init__(self , title , *args , **kwargs) : Tk.__init__(self,*args,**kwargs); self.title(title); self.resizable(False , False); self.drawBoxes(); self.mode = BooleanVar(); self.mode.set(True); self.drawChoice() self.doBtn = Button(self,text=" Try ",bg="#452",fg="#FFF",command=self._onClick) self.doBtn.grid(row=4,column=0,pady=10,padx=5,ipady=2,sticky="we") self.bind("<Return>",self._onClick)
def __init__(self, map): Tk.__init__(self) self.title("GUI window") self.geometry('800x600') display = { 'width': self.winfo_screenwidth(), 'height': self.winfo_screenmmheight() } self.map = Map(self, map) self.map.pack(expand=1, fill='both')
def __init__(self, *args, **kwargs): Tk.__init__(self) Tk.title(self, "Bibeto's App") self.geometry("620x260+30+0") self.container = Frame(self) self.container.pack(side="top", fill="both", expand=True) self.container.grid_rowconfigure(0, weight=1) self.container.grid_columnconfigure(0, weight=1) self.protocol("WM_DELETE_WINDOW", lambda: self.exit_handler())
def __init__(self, *args, **kwargs): """ App class constructor. The arguments are passed to Tk class widget. """ Tk.__init__(self, *args, **kwargs) self.note = None self.status = None self.title('Vy') self.create_widgets()
def __init__(self, *RC, **master): Tk.__init__(self, *RC, **master) self.geometry('1280x720') self.resizable(0, 0) self.title('Teacher Login') self.config(bg='white') self.btn1 = Button(self, text='Show', command=goto_show_records).place(relx=0.5, rely=0.5) self.btn2 = Button(self, text='Show2').place(relx=0.3, rely=0.3)
def __init__(self, *login, **master): Tk.__init__(self, *login, **master) self.geometry("1000x600") self.config(bg='white') self.title("SMS LOGIN") self.resizable(0, 0) self.button = Button(self, text='BACK', command=back_to_main) self.button.place(relx=0.5, rely=0.5) self.button = Button(self, text='GO', command=Window2) self.button.place(relx=0.5, rely=0.5)
def __init__(self): Tk.__init__(self) self.bind("<Escape>", lambda e: self.destroy()) self.bind("<Command-w>", lambda e: self.destroy()) self.bind("<Command-o>", lambda e: self.openDocument()) self.menu = Menu(self, tearoff=0) self.menu.add_command(label="unzip", command=self.unzip) self.lists = [] self.lift() self.attributes('-topmost', True) self.openDocument()
def __init__(self, **kwargs): window_type = kwargs.pop('window_type', '') Tk.__init__(self, **kwargs) self.message = ( '\x1b[31mYour new {} window needs an event loop to become visible.\n' 'Type "%gui tk" below (without the quotes) to start one.\x1b[0m\n' ).format(window_type if window_type else self.winfo_class()) if ip and IPython.version_info < (6, ): self.message = '\n' + self.message[:-1] self._have_loop = False self._check_for_tk()
def __init__(self): Tk.__init__(self) self._text_edit = Text(self) self._text_edit.pack() menu_bar = Menu(self) self['menu'] = menu_bar menu_file = Menu(menu_bar, tearoff=0) menu_bar.add_cascade(label='File', menu=menu_file) menu_file.add_command(label='Open', command=self.open) menu_file.add_command(label='Save', command=self.save) menu_file.add_command(label='Quit', command=self.quit)
def __init__(self, button=True): """Draw a button if requested and a blank canvas""" Tk.__init__(self) self['bg'] = "white" if button: self.b = Button(text="Quit", command=self.destroy, relief=FLAT, bg="white") self.b.pack() self.c = Canvas(bg="white") self.c.pack()
def __init__(self, parent): Tk.__init__(self, parent) self.protocol("WM_DELETE_WINDOW", self.on_closing) self.parent = parent self.grid() self.mybutton = Button(self, text="Открсть PDF файл", command=open_file) self.mybutton.grid(column=0, row=0, sticky='EW') self.mytext = Text(self, state="disabled") self.mytext.grid(column=0, row=1)
def __init__(self): Tk.__init__(self) self.title('Meu console personalizado...') self.bind('<Return>', self.entradaComando) self.fonte = font.Font(family='Consolas', size=11, slant='roman') self.entrada = Text( self, width=100, height=20, bg='#000', fg='#fff', insertbackground='#fff', font=self.fonte ) self.entrada.focus_force() self.entrada.pack(fill=tk.X, expand=tk.TRUE) self.linhaComando()
def __init__(self, *win2, **master): Tk.__init__(self, *win2, **master) self.geometry("1000x600") self.config(bg='white') self.title("SMS LOGIN") self.resizable(0, 0) self.bb = Button(self, text='CHANGE COLOR', command=ChangeColor) self.bb.place(relx=0.5, rely=0.5) self.b2 = Label(self, text='HHAHAHAAHAH', fg="blue") self.b2.place(x=200, y=200)
def __init__(self): Tk.__init__(self) self.factory = None self.width = 520 self.height = 350 self.title('皇家战棋用户登录') self.center_window(self.width, self.height) self.resizable(False, False) self.protocol("WM_DELETE_WINDOW", self.on_close) self.set_ui() self.is_listen = True self.user = None
def __init__(self): try: Tk.__init__(self) except: log_err('no display, exit') exit(1) self.title(get_lang('launcher.title')) if settings['use-theme'] != 'ttk': theme_path = os.path.dirname( os.path.abspath(__file__)) + '/theme/' + settings['use-theme'] self.tk.eval('lappend auto_path {%s}' % theme_path) ttk.Style().theme_use(settings['use-theme']) # 小部件 self.new_button = ttk.Button(self, text=get_lang('launcher.new'), command=self.new) self.start_button = ttk.Button(self, text=get_lang('launcher.start'), command=self.start_game) self.exit_button = ttk.Button(self, text=get_lang('launcher.exit'), command=lambda: exit()) self.game_item_list = Listbox(self, height=12) self.vscroll = ttk.Scrollbar(self, orient='vertical', command=self.game_item_list.yview) self.game_item_list.configure(yscrollcommand=self.vscroll.set) self.repair_button = ttk.Button(self, text=get_lang('launcher.repair'), command=self.repair) self.del_button = ttk.Button(self, text=get_lang('launcher.delete'), command=self.delete) self.rename_button = ttk.Button(self, text=get_lang('launcher.rename'), command=self.rename) # 显示 self.new_button.grid(column=0, row=0, padx=5, pady=5) self.start_button.grid(column=1, row=0, padx=5, pady=5) self.exit_button.grid(column=2, row=0, padx=5, pady=5) self.game_item_list.grid(column=0, columnspan=4, row=1, padx=3, pady=5, sticky='news') self.vscroll.grid(column=4, row=1, padx=2, pady=5, sticky='nes') self.repair_button.grid(column=0, row=2, padx=5, pady=5) self.del_button.grid(column=1, row=2, padx=5, pady=5) self.rename_button.grid(column=2, row=2, padx=5, pady=5) self.resizable(False, False) self.refresh()
def __init__(self): Tk.__init__(self) self.title("uT to qBt convertor") #main frame self.main_frame = Frame(self, padding="3 3 12 12") self.main_frame.grid(column=0, row=0, sticky=(N, W, E, S)) self.main_frame.columnconfigure(0, weight=1) self.main_frame.rowconfigure(0, weight=1) #uT part self.ut_data = StringVar() self.ut_label = Label(self.main_frame, text="uT data") self.ut_label.grid(column=0, row=1, sticky=(W)) self.ut_entry = Entry(self.main_frame, width=100, textvariable=self.ut_data) self.ut_entry.grid(column=1, row=1, sticky=(W)) self.ut_button = Button(self.main_frame, text="Browse", command=self.load_file) self.ut_button.grid(column=2, row=1) #qBt part self.qbt_folder = StringVar() self.qbt_label = Label(self.main_frame, text="qBt folder") self.qbt_label.grid(column=0, row=4, sticky=(W)) self.qbt_entry = Entry(self.main_frame, width=100, textvariable=self.qbt_folder) self.qbt_entry.grid(column=1, row=4, sticky=(W)) self.qbt_button = Button(self.main_frame, text="Browse", command=self.open_dir) self.qbt_button.grid(column=2, row=4, sticky=(W, E)) #convertor self.convertor_button = Button(self.main_frame, text="Convert", command=self.convert, width=50) self.convertor_button.grid(column=1, columnspan=2, row=5) self.progress_bar = Progressbar(self.main_frame, orient=HORIZONTAL, length=300, mode="indeterminate") self.progress_bar.grid(column=1, columnspan=3, row=6) #set padding for each element for child in self.main_frame.winfo_children(): child.grid_configure(padx=5, pady=5)
def __init__(self,root): Tk.__init__(self,root) self.root = root self.trackPath = StringVar() self.info = StringVar() self.sliders = [] self.freqs = [32,62,124,220,440,880,1320,1760,2220,2640] self.canvas = Canvas() self.canvas.pack(expand=YES,fill=BOTH) self.initialize()
def __init__(self, *args, **kwargs): Log.log("Window init") Tk.__init__(self, *args, **kwargs) self.ws_controller = WorkspaceController() self.btn_frame = Frame(self) self.ws_frame = Frame(self) self.btn_frame.grid(row=0, column=0) self.ws_frame.grid(row=0, column=1) test_label = ttk.Label(self.ws_frame, text="This works?!") test_label.grid(row=0, column=0)
def __init__(self): global FMagasin Tk.__init__(self) self.title('Donjon & Python') self.magasin = Magasin.Magasin(self) self.magasin.grid(row=0, column=0) Button(self, text='Jouer', command=self.play, height=2, width=20).grid(row=1, column=1) Button(self,text='Options', command=__main__.ouvrirOption, height=2, width=9).grid(row=1, column=2) self.framePerso = LabelFrame(self, text='Selection du personnage', width=30) self.framePerso.grid(row=0, column=1, columnspan=2) self.OR = Label(self, background='Yellow', height=2, width=70) self.OR.grid(row=1, column=0) self.majOR() self.remplirFramePerso()
def __init__(self): Tk.__init__(self) self.title('Templify!') self.main_frame = ttk.Frame(self) #basic layout management self.columnconfigure(0, weight=1, minsize=500) self.rowconfigure(0, weight=1, minsize=500) self.main_frame.grid(column=0, row=0,sticky="nesw") self.option_add('*tearOff', False) #Start by welcoming the user self.current_frame = None self.switch_frame(Frame_type=WelcomeFrame)
def __init__(self): Tk.__init__(self) Tk.wm_title(self, 'Five in a Row') container = Frame(self) container.pack(side='top', fill='both', expand=True) container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} frame = GameUI(container, self) self.frames[GameUI] = frame frame.grid(row=0, column=0, sticky='nsew') self.show_frame(GameUI)
def __init__(self, filename, title='Tk', preferTk=True): """ Initialize a Tk root and created the UI from a JSON file. Returns the Tk root. """ # Needs to be done this way - because base class do not derive from # object :-( Tk.__init__(self) self.preferTk = preferTk self.title(title) user_interface = json.load(open(filename)) if os.path.isfile( filename) else json.loads(filename) self.create_widgets(self, user_interface)
def __init__(self, title=None): Tk.__init__(self) if title: self.title(title) # check if 'result' variable has been defined by the user yet if 'result' not in self.__dict__: self.result = None body = Frame(self) self.initial_focus = self.body(body) body.pack(padx=5, pady=5) self.buttonbox() self.grab_set() if not self.initial_focus: self.initial_focus = self self.protocol('WM_DELETE_WINDOW', self.cancel) self.initial_focus.focus_set() self.wait_window(self)
def __init__(self, msShowTimeBetweenSlides=1500): # initialize tkinter super class Tk.__init__(self) # time each slide will be shown self.showTime = msShowTimeBetweenSlides # look for images in current working directory where this module lives listOfSlides = [slide for slide in listdir() if slide.endswith('gif')] # endlessly read in the slides so we can show them on the tkinter Label self.iterableCycle = cycle((PhotoImage(file=slide), slide) for slide in listOfSlides) # create tkinter Label widget which can also display images self.slidesLabel = Label(self) # create the Frame widget self.slidesLabel.pack()
def __init__(self): Tk.__init__(self) self.minsize(200, 250) self.result = None self._model_name = '' self._icon_name = '' self.title("Viewer generator") self.grid_columnconfigure(0, weight=0) self.grid_columnconfigure(1, weight=1) self.grid_rowconfigure(0, weight=0) self.grid_rowconfigure(1, weight=1) self.resizable(True, True) Label(self, text='Model').grid(row=0, column=0, sticky=(N, E)) self.models = ttk.Combobox( self, textvariable=StringVar(), state='readonly') self.models.grid(row=0, column=1, sticky=(N, W, E, S), padx=3, pady=3) mainframe = Frame(self, bd=1, relief=SUNKEN) mainframe.grid( row=1, column=0, columnspan=2, sticky=(N, S, E, W), padx=3, pady=3) current_row = 0 current_col = 0 self.check = [] for value in ('add', 'list', 'edit', 'search', 'modify', 'listing', 'show', 'label', 'delete', 'print'): chkbtn_val = IntVar() chkbtn = Checkbutton(mainframe, text=value, variable=chkbtn_val) chkbtn.grid( row=current_row, column=current_col, sticky=W, padx=3, pady=3) self.check.append((value, chkbtn_val)) current_col += 1 if current_col == 2: current_col = 0 current_row += 1 Label(mainframe, text='Icon').grid( row=(current_row + 1), column=0, columnspan=2, sticky=(N, W, E, S), padx=3) self.icons = ttk.Combobox( mainframe, textvariable=StringVar(), state='readonly') self.icons.grid( row=(current_row + 2), column=0, columnspan=2, sticky=(N, W, E, S), padx=3) btnframe = Frame(self, bd=1) btnframe.grid(row=2, column=0, columnspan=2) Button(btnframe, text="OK", width=10, command=self.cmd_ok).grid( row=1, column=0, sticky=(N, S, E, W), padx=5, pady=3) Button(btnframe, text="Cancel", width=10, command=self.cmd_cancel).grid( row=1, column=1, sticky=(N, S, E, W), padx=5, pady=3)
def __init__(self,points): Tk.__init__(self) board = Frame(self) self.title("Diagram") width = 800 #setting height and width height = 600 windowx = self.winfo_screenwidth() windowy = self.winfo_screenheight() x = (windowx - width)/2 #getting center y = (windowy - height)/2 self.geometry("%dx%d+%d+%d" % (width,height,x,y)) #creates window of size _width by _height, and positions it at the center of the screen board.pack(fill=BOTH, expand=1) self.canvas = Canvas(board,height=600,width=800,background="white") self.canvas.place(x=0,y=0) self.drawPoints(points) #Draw points and the first line from the highest an lowest points def point(event): #Add points by clicking on the screen self.canvas.create_text(event.x, event.y,text = "+") points.append([event.x,event.y]) def start(): if(points != []): startB.destroy() quickHullStart(points) self.nextButton() self.canvas.bind("<Button-1>", point) startB = Button(self, text = "Start QuickHull", command = start) startB.pack() self.mainloop()
def __init__(self, *args, **kwargs): Tk.__init__(self, *args, **kwargs) # Set window title self.wm_title('Plastey Configurator') # Create GUI driven variables self._mode = BooleanVar() self._base = BooleanVar() self._comm = BooleanVar() self._pass = StringVar() self._addressed = StringVar() self._connected = StringVar() self._this_host = StringVar() self._this_port = StringVar() self._other_host = StringVar() self._other_port = StringVar() # Create GUI self._build_gui() # Set default values for GUI driven variables self._mode.set(MODE_SINGLE_PLAYER) self._base.set(BASE_OPENED_GEOMETRY) self._comm.set(COMM_SOCKET_SERVER) self._pass.set('') self._addressed.set(ADDR_HAVE_ADDRESS if check(COMM_THIS_HOST) else ADDR_NO_ADDRESS) self._connected.set(CONN_NOT_CONNECTED) self._this_host.set(COMM_THIS_HOST) self._this_port.set(COMM_THIS_PORT) self._other_host.set(COMM_THIS_HOST) self._other_port.set(COMM_OTHER_PORT) # Follow changes on password self._pass.trace('w', self._on_bind_address) # Create folder structures if they don't exists yet makedirs(FILE_TEMPORARY_FOLDER, exist_ok=True) makedirs(FILE_PERMANENT_FOLDER, exist_ok=True) makedirs(FILE_TEMP_SAVE_FOLDER, exist_ok=True) makedirs(FILE_AUTO_SAVE_FOLDER, exist_ok=True)
def __init__(self, filename=None, block=50, debug=True, delay=0.25, image=False, width=10, height=10): Tk.__init__(self) self.title("") arg = block self.width = width self.height = height self.beepers = {} self.ovals = {} self.numbers = {} self.robots = {} self.walls = {} self.m = arg * (width + 3) self.n = arg * (height + 3) self.t = arg self.delay = delay self.debug = debug self.use_image = image a = self.t + self.t / 2 b = self.m - self.t / 2 c = self.n - self.t / 2 self.canvas = Canvas(self, bg="white", width=self.m, height=self.n) self.canvas.pack() count = 1 for k in range(2*self.t, max(self.m, self.n)-self.t, self.t): if k < b: self.canvas.create_line(k, c, k, a, fill="red") self.canvas.create_text(k, c+self.t/2, text=str(count), font=("Times", max(-self.t*2/3, -15), "")) if k < c: self.canvas.create_line(b, k, a, k, fill="red") self.canvas.create_text(a-self.t/2, self.n-k, text=str(count), font=("Times", max(-self.t*2/3, -15), "")) count += 1 self.canvas.create_line(a, c, b, c, fill="black", width=3) self.canvas.create_line(a, a, a, c, fill="black", width=3) if filename is not None: self.read_world(filename) self.refresh()
def __init__(self): """ Initializes the control object and controls of the form. """ Tk.__init__(self) Observer.__init__(self) self.ctrl_anon = None self.resizable(0, 0) self._reset_controls() # Center window width = 800 height = 500 scr_width = self.winfo_screenwidth() scr_height = self.winfo_screenheight() # Calculate dimensions x = (scr_width/2) - (width/2) y = (scr_height/2) - (height/2) # Set window dimensions geo = str(width) + "x" + str(height) + "+" + str(x)[:-2] + "+" + str(y)[:-2] self.geometry(geo)
def __init__(self): Tk.__init__(self) try: img = Image("photo", file=join( dirname(import_module('lucterios.install').__file__), "lucterios.png")) self.tk.call('wm', 'iconphoto', self._w, img) except: pass self.has_checked = False self.title(ugettext("Lucterios installer")) self.minsize(475, 260) self.grid_columnconfigure(0, weight=1) self.grid_rowconfigure(0, weight=1) self.running_instance = {} self.resizable(True, True) self.protocol("WM_DELETE_WINDOW", self.on_closing) self.ntbk = ttk.Notebook(self) self.ntbk.grid(row=0, column=0, columnspan=1, sticky=(N, S, E, W)) self.create_instance_panel() self.create_module_panel() stl = ttk.Style() stl.theme_use("default") stl.configure("TProgressbar", thickness=5) self.progress = ttk.Progressbar( self, style="TProgressbar", orient='horizontal', mode='indeterminate') self.progress.grid(row=1, column=0, sticky=(E, W)) self.btnframe = Frame(self, bd=1) self.btnframe.grid(row=2, column=0, columnspan=1) Button(self.btnframe, text=ugettext("Refresh"), width=20, command=self.refresh).grid( row=0, column=0, padx=3, pady=3, sticky=(N, S)) self.btnupgrade = Button( self.btnframe, text=ugettext("Search upgrade"), width=20, command=self.upgrade) self.btnupgrade.config(state=DISABLED) self.btnupgrade.grid(row=0, column=1, padx=3, pady=3, sticky=(N, S)) Button(self.btnframe, text=ugettext("Close"), width=20, command=self.on_closing).grid( row=0, column=2, padx=3, pady=3, sticky=(N, S))
def __init__( self ): Tk.__init__( self ) self.title( 'Multiple Sequence Aligner' ) self.rowconfigure( 0, weight=1 ) self.columnconfigure( 0, weight=1 ) self.minsize(300,275) # Should probably add a frame here to make the padding look better. self.mainInterface = MainTabInterface( self ) self.mainInterface.grid( column=0, row=0, columnspan=2, sticky=( N, W, E, S ) ) #TODO when the UI is a separate thread, add this back. Then fix statusLabel. self.progressIndicator = ttk.Progressbar( self, mode='indeterminate' ) #self.progressIndicator.grid( column=0, columnspan=2, row=1, sticky=W ) self.statusLabel = ttk.Label( self, pad=5 ) self.statusLabel.grid( column=0, columnspan=2, row=1, sticky=W ) self.submitButton = ttk.Button( self, text='Start' ) self.submitButton.grid( column=1, row=1, sticky=E )
def __init__(self): Tk.__init__(self) self.title("Nim") self.kamen = PhotoImage(file = './kamen.ppm') self.nacin = BooleanVar() #0 is ai, 1 is human self.nacin = 0 self.zahtevnost = DoubleVar() #0, 1, 2 are (easy, medium hard) self.vnos_nacina = Entry(self, textvariable = "način") ni = Button(self, text="Nova igra", command=self.nova_igra) ni.grid(column = 2, row = 0) self.platno = Canvas(self, width=700, height = 500, bg='white') self.platno.grid(row= 3, column = 0, columnspan=4) self.vrhovi = [] self.z1 = Radiobutton(self, text = "Skoraj Nepremagljivo!", variable = self.zahtevnost, value=1) self.z2 = Radiobutton(self, text = "Srednje zahtevno ", variable = self.zahtevnost, value=2) self.z3 = Radiobutton(self, text = "Za majhne punčke ", variable = self.zahtevnost, value=3) self.z1.grid(column = 0, row = 0) self.z2.grid(column = 0, row = 1) self.z3.grid(column = 0, row = 2) self.z1.select() self.konec = Label() self.mainloop()
def __init__(self,parent=None): Tk.__init__(self,parent) self.parent = parent self.initialize()
def __init__(self, app, kind='', iconfile=None): self.findIcon() Tk.__init__(self) self.__app = app self.configBorders(app, kind, iconfile)
def __init__(self, config: Config, filesystem: Filesystem): Tk.__init__(self) self.config = config self.filesystem = filesystem self.bind("<Configure>", self.on_resize) self.image_frame = tkinter.Frame(self) self.image_frame.pack(side="left", fill="both", expand=True, padx=5) self.control_frame = tkinter.Frame(self) self.control_frame.pack(side="right", fill="both", expand=False, padx=5) self.destinations_frame = tkinter.Frame(self.control_frame) self.destinations_frame.pack(fill="y", expand=1) self.separator = ttk.Separator(self.control_frame) self.separator.pack(fill="x", expand=0, pady=5) self.sources_frame = tkinter.Frame(self.control_frame) self.sources_frame.pack(fill="y", expand=1) self.image_preview = tkinter.Label(self.image_frame) self.image_preview.pack(fill="both", expand=True) # Add the thumbnail list here self.destination_label = tkinter.Label(self.destinations_frame, text="Destinations") self.destination_label.grid(row=0, column=0, columnspan=2) self.destination_list = tkinter.Listbox(self.destinations_frame) self.populate_listbox(self.destination_list, "destinations") self.destination_list.bind('<Double-Button-1>', self.move_image_handler) self.destination_list.grid(row=1, column=0, columnspan=2, sticky="ns") self.add_destination = tkinter.Button(self.destinations_frame, text="Add", command=self.add_destination_handler) self.add_destination.grid(row=2, column=0, sticky="ew") self.remove_destination = tkinter.Button(self.destinations_frame, text="Remove", command=self.remove_destination_handler) self.remove_destination.grid(row=2, column=1, sticky="ew", pady=5) self.source_label = tkinter.Label(self.sources_frame, text="Sources") self.source_label.grid(row=0, column=0, columnspan=2, sticky="ns", pady=5) # @todo: Actually set up the source list to work properly with adding/removing self.source_list = tkinter.Listbox(self.sources_frame) self.populate_listbox(self.source_list, "sources") self.source_list.grid(row=1, column=0, columnspan=2, sticky="ns") self.add_source = tkinter.Button(self.sources_frame, text="Add", command=self.add_source_handler) self.add_source.grid(row=2, column=0, sticky="ew", pady=5) self.remove_source = tkinter.Button(self.sources_frame, text="Remove", command=self.remove_source_handler) self.remove_source.grid(row=2, column=1, sticky="ew", pady=5) self.sources_frame.rowconfigure(1, weight=1) self.destinations_frame.rowconfigure(1, weight=1) self.menubar = tkinter.Menu(self) self.filemenu = tkinter.Menu(self.menubar, tearoff=0) self.filemenu.add_command(label="Quit", command=self.quit) self.menubar.add_cascade(label="File", menu=self.filemenu) self.helpmenu = tkinter.Menu(self.menubar, tearoff=0) self.menubar.add_cascade(label="Help", menu=self.helpmenu) self.debuglevel = tkinter.IntVar() self.debuglevel.set(logging.getLogger().level) self.debugmenu = tkinter.Menu(self.helpmenu, tearoff=0) self.debugmenu.add_radiobutton(label="OFF", command=self.set_logging, variable=self.debuglevel, value=logging.NOTSET) self.debugmenu.add_radiobutton(label="DEBUG", command=self.set_logging, variable=self.debuglevel, value=logging.DEBUG) self.debugmenu.add_radiobutton(label="INFO", command=self.set_logging, variable=self.debuglevel, value=logging.INFO) self.debugmenu.add_radiobutton(label="WARNING", command=self.set_logging, variable=self.debuglevel, value=logging.WARNING) self.debugmenu.add_radiobutton(label="ERROR", command=self.set_logging, variable=self.debuglevel, value=logging.ERROR) self.debugmenu.add_radiobutton(label="CRITICAL", command=self.set_logging, variable=self.debuglevel, value=logging.CRITICAL) self.helpmenu.add_cascade(label="Set Debug Level", menu=self.debugmenu) self.configure(menu=self.menubar) self.update() self.set_image(filesystem.get_next_image())
def __init__(self): Tk.__init__(self) self.tilt_val_init = 110 self.pan_val_init = 75 self.pan_min = 0 self.pan_max = 105 self.tilt_min = 35 self.tilt_max = 135 self.pas = 5 # Full Screen largeur, hauteur = self.winfo_screenwidth(), self.winfo_screenheight() self.overrideredirect(0) self.geometry("%dx%d" % (largeur, hauteur)) # TILT self.tilt_bar = Scale(self, from_=self.tilt_min, to=self.tilt_max, length=250, label='Tilt', sliderlength=20, orient=HORIZONTAL, command=self.update_tilt) self.tilt_bar.set((self.tilt_max + self.tilt_min) // 2) self.tilt_bar.grid(row=1, column=2) self.tilt_angle = StringVar() self.tilt_val = self.tilt_bar.get() # PAN self.pan_bar = Scale(self, from_=self.pan_min, to=self.pan_max, length=250, label='Pan', sliderlength=20, orient=HORIZONTAL, command=self.update_pan) self.pan_bar.set((self.pan_max + self.pan_min) // 2) self.pan_bar.grid(row=2, column=2) self.pan_angle = StringVar() self.pan_val = self.pan_bar.get() # PS3 Controller self.bind("<a>", self.pan_plus) self.bind("<d>", self.pan_moins) self.bind("<s>", self.tilt_plus) self.bind("<w>", self.tilt_moins) self.bind("<p>", self.lean_left) self.bind("<m>", self.lean_right) self.bind("<q>", self.initialiser_positon) self.bind("<j>", self.forward) self.bind("<u>", self.reverse) self.bind("<h>", self.left) self.bind("<k>", self.right) self.bind("<i>", self.break_motor) self.bind("<Button-2>", self.alarm) self.bind("<Button-3>", self.beep) # Motor self.gear = 0 self.speed_init = 5 self.speed = self.speed_init self.leds = [led_1, led_2, led_3] self.bind("<e>", self.shift_down) self.bind("<r>", self.shift_up) self.pwm = gpio.PWM(enable_pin, 50) # 50 is the frequency # Infos self.pas_label = Label(self, text=str(self.pas)) self.pas_label.grid(row=3) self.buzzer_state = 0