def add_window(self): #Create New Window Frame = Toplevel() Frame.title('Another Window') Date_label = Label(Frame, text='Date:') Name_label = Label(Frame, text='Name:') Transaction_Label = Label(Frame, text='Transaction:') Description_Label = Label(Frame, text='Description:') Date_label.grid(column=0, row=0) Name_label.grid(column=0, row=1) Transaction_Label.grid(column=0, row=2) Description_Label.grid(column=0, row=3) self.Date_Entry = Entry(Frame) self.Name_Entry = Entry(Frame) self.Transaction_Entry = Entry(Frame) self.Description_Entry = Entry(Frame) self.Date_Entry.grid(column=1, row=0) self.Name_Entry.grid(column=1, row=1) self.Transaction_Entry.grid(column=1, row=2) self.Description_Entry.grid(column=1, row=3) Submit = Button(Frame, text='Submit', command=self.submit) Submit.grid(column=1, row=5, pady=20) self.r = tk.IntVar() RadioLayer = LabelFrame(Frame) RadioLayer.grid(column=0, row=6) Operation = [('Income', 1), ('Expense', -1)] for text, mode in Operation: #Income or Expense color coding (Not yet included), also a way to prevent accident listing of whats income and expense Radiobutton(RadioLayer, text=text, variable=self.r, value=mode).pack() self.Category = tk.StringVar() dropmenu = OptionMenu( Frame, self.Category, 'Income', 'Food', 'Utility', 'Subscriptions') #Allows to select which type of expense dropmenu.grid(column=1, row=6) Frame.geometry('250x250')
def add_window(): Frame = Toplevel() Frame.title('Another Window') Date_label = Label(Frame, text='Date:') Name_label = Label(Frame, text='Name:') Transaction_Label = Label(Frame, text='Transaction:') Category_Label = Label(Frame, text='Category:') Description_Label = Label(Frame, text='Description:') Date_label.grid(column=0, row=0) Name_label.grid(column=0, row=1) Transaction_Label.grid(column=0, row=2) Category_Label.grid(column=0, row=3) Description_Label.grid(column=0, row=4) Date_Entry = Entry(Frame) Name_Entry = Entry(Frame) Transaction_Label = Entry(Frame) Category_Label = Entry(Frame) Description_Label = Entry(Frame) Date_Entry.grid(column=1, row=0) Name_Entry.grid(column=1, row=1) Transaction_Label.grid(column=1, row=2) Category_Label.grid(column=1, row=3) Description_Label.grid(column=1, row=4) Submit = Button(Frame, text='Submit', command=submit) Submit.grid(column=1, row=5, pady=20) r = tk.IntVar() RadioLayer = LabelFrame(Frame) RadioLayer.grid(column=0, row=6) Operation = [('Income', 1), ('Expense', -1)] for text, mode in Operation: Radiobutton(RadioLayer, text=text, variable=r, value=mode).pack() Frame.geometry('250x250')
def __init__(self, poetry_root: tk.Frame) -> None: """Initialize the Poetry App along with its gadgets""" # Read the dictionary and poetry forms files self.word_pronunciations = poetry_reader.read_pronouncing_dictionary( open(DICTIONARY_FILENAME, 'r', encoding="utf-8")) self.poetry_patterns = poetry_reader.read_poetry_form_descriptions( open(POETRY_FORMS_FILENAME, 'r', encoding="utf-8")) # Build the user interface poetry_root.title("Pure Poetry") screen_width = poetry_root.winfo_screenwidth() screen_height = poetry_root.winfo_screenheight() width, height = screen_width * 0.5, screen_height * 0.5 self.width, self.height = width, height # calculate x and y coordinates for the Tk root window x = (screen_width / 2) - (width / 2) y = (screen_height / 2) - (height / 2) self.annotation_height = int(self.height / 50) # set the dimensions of the screen and where it is placed poetry_root.geometry('%dx%d+%d+%d' % (width, height, x, y)) self.master = poetry_root tk.Frame.__init__(self, poetry_root) self.scroll_frame = ScrollFrame(self) self.scroll_frame.width = width self.scroll_frame.height = height self.create_screen_components() # pack scrollFrame itself self.scroll_frame.pack(side="top", fill="both", expand=True, padx=(5, 0), pady=(5, 0))
def __init__(self, master): self.ser = Serial('/dev/ttyACM0', '9600') frame = Frame(master) frame.title = "Janela" frame.pack() self.display = 0 self.button01 = Button(frame, text="Desligado", fg="red") self.button01.grid(row=0, column=0) self.button01.configure( command=lambda btn=self.button01: self.trata_botoes(1, btn)) self.button02 = Button(frame, text="Desligado", fg="red") self.button02.grid(row=0, column=1) self.button02.configure( command=lambda btn=self.button02: self.trata_botoes(2, btn)) self.button03 = Button(frame, text="Desligado", fg="red") self.button03.grid(row=0, column=2) self.button03.configure( command=lambda btn=self.button03: self.trata_botoes(3, btn)) self.button04 = Button(frame, text="Desligado", fg="red") self.button04.grid(row=0, column=3) self.button04.configure( command=lambda btn=self.button04: self.trata_botoes(4, btn)) self.button05 = Button(frame, text="Desligado", fg="red") self.button05.grid(row=1, column=0) self.button05.configure( command=lambda btn=self.button05: self.trata_botoes(5, btn)) self.button06 = Button(frame, text="Desligado", fg="red") self.button06.grid(row=1, column=1) self.button06.configure( command=lambda btn=self.button06: self.trata_botoes(6, btn)) self.button07 = Button(frame, text="Desligado", fg="red") self.button07.grid(row=1, column=2) self.button07.configure( command=lambda btn=self.button07: self.trata_botoes(7, btn)) self.button08 = Button(frame, text="Desligado", fg="red") self.button08.grid(row=1, column=3) self.button08.configure( command=lambda btn=self.button08: self.trata_botoes(8, btn)) self.button09 = Button(frame, text="Sequencial01") self.button09.grid(row=2, columnspan=4) self.button09.configure( command=lambda btn=self.button09: self.sequencial(btn)) self.button10 = Button(frame, text="Sequuencial02") self.button10.grid(row=3, columnspan=4) self.button10.configure( command=lambda btn=self.button10: self.sequencial(btn)) self.button11 = Button(frame, text="Apaga_tudo") self.button11.grid(row=4, columnspan=4) self.button11.configure( command=lambda btn=self.button11: self.sequencial(btn))