Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter
#11
(Sep-15-2020, 03:38 PM)Knight18 Wrote: The most obvious mistake is that you're creating separate Tkinter sessions with Tk(). There's probably other things wrong with your code as well, but if you want to be creating several windows, you should use the top level widget.

ok, thanks I got it
they work great
just missing one thing,
what if in a toplevel window nonrelated to root, I have a button to open another similar toplevel window and at the same time I need to close the previous toplevel window
if I choose to open the second window in command = open_toplevel2
I left the previous window open and I need to close it when the button is pressed, so basically I need to commands in one

thx for your help

(Sep-16-2020, 07:26 PM)juliolop Wrote:
(Sep-15-2020, 03:38 PM)Knight18 Wrote: The most obvious mistake is that you're creating separate Tkinter sessions with Tk(). There's probably other things wrong with your code as well, but if you want to be creating several windows, you should use the top level widget.

ok, thanks I got it
they work great
just missing one thing,
what if in a toplevel window nonrelated to root, I have a button to open another similar toplevel window and at the same time I need to close the previous toplevel window
if I choose to open the second window in command = open_toplevel2
I left the previous window open and I need to close it when the button is pressed, so basically I need to commands in one

thx for your help

(Sep-16-2020, 06:53 PM)deanhystad Wrote: If you are just starting you should look for a tkinter tutorial that makes multiple windows.

thanks
but the tutorials I have only show opening new windows leaving the previous window open,like a cascade, and what I really need is to open a new window disappearing the previous one.

thanks again
Reply
#12
That is not a common user interface paradigm, which usually means it is a bad user interface paradigm. More common would be a single window that changes it's view. To do this you would create multiple frames and only show 1 at a time. The tkinter notebook widget could be used for this, but you can also "roll your own" interface if you don't like the notebook's tabbed interface.
Reply
#13
ok I used ttk notebook widget and I liked, certainly is really functional for what I wish to do, but after looking in several tutorials I can not find how to place a label widget or a simple text inside the particular tab window other than the tab "note"
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020