Button placement

Peter Otten __peter__ at web.de
Tue Mar 9 03:00:23 EST 2021


On 09/03/2021 03:08, Bischoop wrote:
> 
> 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, 

I'm not sure what you mean, do you perhaps need columnspan=3?

> 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'

# no Canvas
bgs = Button(
     root,
     text="Password Manager & Generator",
     background='#0f2a52', foreground="orange",
     font=("Times New Roman", 15, 'bold')
)
bgs.grid(column=0, row=0, pady=10, columnspan=3)

> 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