Python Forum
[Tkinter] Command button, then more command buttons
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Command button, then more command buttons
#1
I am a beginner trying to learn Tkinter.

The objectives of the following code are to
1) Show a red "Press here to start button."
2) After the "Press here to start button is pressed it disappears and 5 option command buttons come up.

Questions
1) The red "Press here to start button" does not disappear, when the option buttons appear. I know I could use pack_forget or destroy to accomplish this but I can't get them to work.
2) Is using a function to get the second set of command buttons to come up, the usual way this is done or is there a better way?


from tkinter import *
root = Tk()
root.geometry("800x800")

#Secondmenu brings up a second set of buttons.  How do I make the "Press here to starbutton" disappear before this second set of buttons come up

def secondmenu():

    Option1  = Button(root, text="Option1", bg="white", \
                            fg="firebrick", relief = "groove", font = "Helvitica 30",).pack()

    Option2  = Button(root, text="Option2", bg="white", \
                            fg="firebrick", relief = "groove", font = "Helvitica 30",).pack()

    Option3  = Button(root, text="Option3", bg="white", \
                            fg="firebrick", relief = "groove", font = "Helvitica 30", ).pack()

    Option4  = Button(root, text="Option4", bg="white", \
                            fg="firebrick", relief = "groove", font = "Helvitica 30", ).pack()

    Option5  = Button(root, text="Option5", bg="white", \
                            fg="firebrick", relief = "groove", font = "Helvitica 30",).pack()


#This is the button you will see when you start the program

start = Button(root, text="Press here to start", bg="red", fg="black", font = "Helvitica 30",command = secondmenu).pack()
#start.pack_forget()


root.mainloop()
Reply


Messages In This Thread
Command button, then more command buttons - by Heyjoe - Aug-04-2020, 11:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  I'm trying to create a GUI in Python which would accept a bash command max22 1 688 Nov-13-2023, 04:40 AM
Last Post: deanhystad
  [PyGUI] Invalid command error with Entry object eliqm 8 2,152 May-18-2023, 10:14 PM
Last Post: eliqm
  tkinter.TclError: can't invoke "canvas" command cybertooth 8 5,962 Feb-23-2023, 06:58 PM
Last Post: deanhystad
  [PyQt] command require close window Krissstian 14 2,939 Nov-19-2022, 04:18 PM
Last Post: Krissstian
  [Tkinter] Scrollable buttons with an add/delete button Clich3 5 3,424 Jun-16-2022, 07:19 PM
Last Post: rob101
  [Tkinter] Button 'command' Argument Confusion gw1500se 11 5,859 Nov-11-2021, 08:45 PM
Last Post: menator01
  [Tkinter] Extracting Data from a Command Subroutine gw1500se 0 1,106 Nov-11-2021, 08:02 PM
Last Post: gw1500se
  [Tkinter] _tkinter.TclError: can't invoke "destroy" command: application has been destroyed knoxvilles_joker 6 15,543 Apr-25-2021, 08:41 PM
Last Post: knoxvilles_joker
  Continue command in python tkinter? MLGpotato 7 8,464 Mar-27-2021, 04:59 AM
Last Post: deanhystad
  [PyGUI] My GUI crashes after command MLGpotato 1 1,897 Feb-21-2021, 03:17 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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