Button placement

Bischoop Bischoop at vimart.net
Mon Mar 8 21:08:59 EST 2021


I try for a while place the top button in a a middle of column=0 with
span to column2 below so the button being centered to those, tried with
canvas as well but with no success. Is someone with Tkinter experience
able to advice what I could do?

from tkinter import *
from tkinter import ttk

root = Tk()

root.title('Password Generator')
root.config(padx=10, pady=10)

backg = '#06090f'

canvas = Canvas(root, width=80, height=40).grid(column=0, row=0, columnspan=2,sticky=E)
bgs = Button(canvas, text="Password Manager & Generator", background='#0f2a52', foreground="orange",
             font=("Times New Roman", 15, 'bold')).grid(column=0, row=0, pady=10, columnspan=2)
long_t = Label(text='Password Length:')
long_t.grid(column=0, row=1)
choice_n = IntVar()
choice = ttk.Combobox(width=10)
w = [x for x in range(8, 16)]
choice['values'] = w
choice.grid(row=1, column=1)
choice.current()
choice.bind("<<ComboboxSelected>>")
password_text = Label(text='Password: ')
password_text.grid(row=2, column=0)
password_entry = Entry(width=20)
password_entry.grid(row=2, column=1)
gen = Button(text='Generate Password')
gen.grid(row=1, column=2, sticky=W)


More information about the Python-list mailing list