Python Forum
[Tkinter] Make A Button That Opens Another Tk() Window That I Have Made
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Make A Button That Opens Another Tk() Window That I Have Made
#1
I have made two windows
StartScreen=tk()
and FirstScreen=tk()
I want to make a button on StartScreen that opens up the window FirstScreen
This is the code for the startscreen-
###################################################
from tkinter import *
##################################################
StartScreen=Tk()
##Photo Car##
PhotoCarRed = PhotoImage(file="D:\Python Projects\Parking Management System\Photos\Best-High-Resolution-Photos-For-Cars.png")
PlacementPhotoCarRed = Label(StartScreen, image = PhotoCarRed)
PlacementPhotoCarRed.pack(side="top", fill=X )
###ToolBar on the bottom of the screen
toolbar= Frame(StartScreen, bg="white")
Button1 = Button(toolbar, text="Book A Parking Space Right Now!", relief = RAISED)
Button1.pack(side="left", padx=10, pady=10)
Button2 = Button(toolbar, text="Have Your Own Parking? Register With Us!", relief = RAISED)
Button2.pack(side="left", padx=10, pady=10)
Button3 = Button(toolbar, text="Want To Cancel Your Reservation?", relief = RAISED)
Button3.pack(side="right", padx=10, pady=10)
toolbar.pack(side="bottom")

StartScreen.mainloop()
This is the code for the second tk() that is FirstScreen

####################
from tkinter import *
####################
FirstScreen = Tk()
###################
"""Size of city screen image = 720x200 px"""
WelcomePic = PhotoImage(file="D:\Python Projects\Parking Management System\Photos\CITYWALLPAPERLOWERTOOLBAR.png")
WelcomePicPlacement=Label(FirstScreen,image=WelcomePic)
WelcomePicPlacement.pack(side="top",fill="both")
######################
"""Drop Drop Menus On The Top Of The Screen"""
#######################
DropDownMenuToShowcase = Menu(FirstScreen)
FirstScreen.configure(menu=DropDownMenuToShowcase)

WhatWeDo= Menu(DropDownMenuToShowcase)
DropDownMenuToShowcase.add_cascade(label="What We Do", menu = WhatWeDo)
WhatWeDo.add_command(label="Reservations For Hotel Parking")
WhatWeDo.add_command(label="Reservations For Clubs")
WhatWeDo.add_command(label="Reservations For Events")
WhatWeDo.add_command(label="Reservations For Institutions ")
WhatWeDo.add_command(label="Reservations For Workplaces")

FirstScreen.mainloop()
I want to make a button on StarScreen, which, upon clicking, makes the FirstScreen window appear.

Thank you.
Reply


Messages In This Thread
Make A Button That Opens Another Tk() Window That I Have Made - by Saif133 - Jan-04-2017, 05:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Interaction between Matplotlib window, Python prompt and TKinter window NorbertMoussy 3 540 Mar-17-2024, 09:37 AM
Last Post: deanhystad
  How can I run an interface I made using PyQt5 and a Map program I made using Tkinter bki 6 1,182 Nov-09-2023, 11:12 PM
Last Post: bki
  Centering and adding a push button to a grid window, TKinter Edward_ 15 4,906 May-25-2023, 07:37 PM
Last Post: deanhystad
  [Tkinter] how to make label or button not visible with the place method? nowayj63 2 2,847 Jan-03-2023, 06:29 PM
Last Post: Yoriz
Question [Tkinter] How to make split button? teknixstuff 2 1,076 Jan-03-2023, 06:21 PM
Last Post: Yoriz
  [Tkinter] MenuBar hidden when new window opens john8888 5 1,449 Sep-14-2022, 02:32 PM
Last Post: john8888
  [Tkinter] GUI Opens Minimized gw1500se 24 5,879 May-05-2022, 04:12 PM
Last Post: deanhystad
  [Tkinter] Clicking on the button crashes the TK window ODOshmockenberg 1 2,258 Mar-10-2022, 05:18 PM
Last Post: deanhystad
  [Tkinter] Make my button text update? Skata100 1 2,045 Aug-07-2021, 05:37 AM
Last Post: deanhystad
  [Tkinter] [split] [split] How to make a window stay on top knoxvilles_joker 10 6,192 May-22-2021, 03:54 AM
Last Post: knoxvilles_joker

Forum Jump:

User Panel Messages

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