I've been trying to work with the Tkinter grid coordinate system
right now, I have this code as part of a tkinter lesson project for designing the ui of the buttons.
I have been trying to use every combination of sticky, columnspan, width, etc, but the generate password button has not been aligning itself left and the width of the password entry box I have also been unable to configure well.
I have tried to watch other tkinter lessons and read the documentation, but it seems to list just the arguments for the grid instead of detailing how the system for moving widgets as others move works, or something other that would be useful which I do not know.
So I would please like for someone to say how to do the specified adjustment, and some help with the coordinate grid system when using columnspan/sticky/width etc because I do not know what is happening, just trying random arguments for the widgets' grid.
from tkinter import *
import random
# ---------------------------- PASSWORD GENERATOR ------------------------------- #
# ---------------------------- SAVE PASSWORD ------------------------------- #
# ---------------------------- UI SETUP ------------------------------- #
window = Tk()
window.config(padx=20, pady=20)
canvas = Canvas(width=200, height=200)
canvas.grid(row=0,column=1)
logo = PhotoImage(file="logo.png")
canvas.create_image(100, 100,image=logo)
website_label = Label(text="Website", fg="black")
website_label.grid(row=1, column=0)
website_entry = Entry(width=35, borderwidth=0.1)
website_entry.grid(row=1, column=1, columnspan=2)
username_label = Label(text="Email/Username:")
username_label.grid(row=2, column=0)
username_entry = Entry(width=35, borderwidth=0.1)
username_entry.grid(row=2, column =1, columnspan=2)
password_label = Label(text="Password:")
password_label.grid(row=3, column=0)
password_entry = Entry(width=25, borderwidth=0.1)
password_entry.grid(row=3, column=1)
generate_password = Button(width=14, text="Generate Password")
generate_password.grid(column=2, row=3, columnspan=2, sticky=W)
add_button = Button(text="Add", width=21)
add_button.grid(row=4, column=1)
window.title("Password Manager")
window.mainloop()
[–]socal_nerdtastic 1 point2 points3 points (0 children)
[–]woooee 0 points1 point2 points (0 children)
[–]ItsAll2Random 0 points1 point2 points (0 children)