Tkinter Frame
Tkinter Frame
def create_input_frame(container):
frame = ttk.Frame(container)
# Find what
ttk.Label(frame, text='Find what:').grid(column=0, row=0, sticky=tk.W)
keyword = ttk.Entry(frame, width=30)
keyword.focus()
keyword.grid(column=1, row=0, sticky=tk.W)
# Replace with:
ttk.Label(frame, text='Replace with:').grid(column=0, row=1, sticky=tk.W)
replacement = ttk.Entry(frame, width=30)
replacement.grid(column=1, row=1, sticky=tk.W)
return frame
def create_button_frame(container):
frame = ttk.Frame(container)
frame.columnconfigure(0, weight=1)
def create_main_window():
# root window
root = tk.Tk()
root.title('Replace')
root.geometry('400x150')
root.resizable(0, 0)
# windows only (remove the minimize/maximize button)
root.attributes('-toolwindow', True)
input_frame = create_input_frame(root)
input_frame.grid(column=0, row=0)
button_frame = create_button_frame(root)
button_frame.grid(column=1, row=0)
root.mainloop()
if __name__ == "__main__":
create_main_window()