Python Forum
function in new window (tkinter)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function in new window (tkinter)
#7
I removed everything not needed to draw a new window for entering info to carpet a room.
You cannot use input to get info from this window or print to write to this window. You will have to create tk controls to do that stuff.
from tkinter import *

master = Tk()
master.title("Carpet shop")
 
def carpetRooms():
    newWindow = Toplevel(master)
    newWindow.geometry("350x350")
    newWindow.title("Carpet (rooms)")
    # Add code here to create Entries and labels and buttons
    # to enter the info needed to carpet a room.
     
Button(master, text="Carpet (rooms)", command = carpetRooms).grid(row=1,column=3)
 
master.mainloop()
You should avoid using pop-up windows when possible. Take a look at the tk notebook control which is a tabbed interface with multiple pages. You could replace your buttons with tabs, and the notebook pages take the place of your pop-up windows. This is the "approved" best way to make a GUI application with multiple views. I think the main reason for this is you can jump between views easily, maybe for reference or maybe cutting and pasting. This is tough to do if you have a pop-up view that goes away when another view is selected. And if you allow multiple pop-ups at the same time the screen gets cluttered.
Reply


Messages In This Thread
function in new window (tkinter) - by Dale22 - Nov-22-2020, 03:14 PM
RE: function in new window (tkinter) - by Dale22 - Nov-23-2020, 04:50 PM
RE: function in new window (tkinter) - by Larz60+ - Nov-23-2020, 08:24 PM
RE: function in new window (tkinter) - by Dale22 - Nov-24-2020, 07:16 PM
RE: function in new window (tkinter) - by Larz60+ - Nov-24-2020, 08:08 PM
RE: function in new window (tkinter) - by Dale22 - Nov-24-2020, 09:36 PM
RE: function in new window (tkinter) - by deanhystad - Nov-24-2020, 10:37 PM
RE: function in new window (tkinter) - by Dale22 - Nov-24-2020, 11:28 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 588 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  Using Tkinter inside function not working Ensaimadeta 5 5,141 Dec-03-2023, 01:50 PM
Last Post: deanhystad
  Tkinter multiple windows in the same window tomro91 1 893 Oct-30-2023, 02:59 PM
Last Post: Larz60+
  Centering and adding a push button to a grid window, TKinter Edward_ 15 5,016 May-25-2023, 07:37 PM
Last Post: deanhystad
  [Tkinter] Open tkinter colorchooser at toplevel (so I can select/focus on either window) tabreturn 4 1,965 Jul-06-2022, 01:03 PM
Last Post: deanhystad
  Tkinter won't run my simple function AthertonH 6 3,966 May-03-2022, 02:33 PM
Last Post: deanhystad
  [Tkinter] Background inactivity timer when tkinter window is not active DBox 4 2,972 Apr-16-2022, 04:04 PM
Last Post: DBox
  why my list changes to a string as I move to another window in tkinter? pymn 4 2,609 Feb-17-2022, 07:02 AM
Last Post: pymn
  [Tkinter] tkinter best way to pass parameters to a function Pedroski55 3 4,928 Nov-17-2021, 03:21 AM
Last Post: deanhystad
  [Tkinter] Tkinter Window Has no Title Bar gw1500se 4 2,887 Nov-07-2021, 05:14 PM
Last Post: gw1500se

Forum Jump:

User Panel Messages

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