Python Forum
GUI skips code part
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GUI skips code part
#1
Hello!
Can anyone help me? I dont know why but it just litearly skips gamemain(). :/ Wall Currently there are no errors in the code.
from tkinter import *
import random
import tkinter
import time

def gamemain(): #It skips this code
    gametext0 = Label(root , text = "1")
    gametext1 = Label(root , text ="2")
    gametext2 = Label(root, text ="3")
    gametext3 = Label(root , text = "4")
    gameinput0 = Entry(root , width=50, borderwidth=5)
    enter = Button(root, text = "Name your self", command = main())
    gametext0.pack()
    gametext1.pack()
    gametext2.pack()
    gametext3.pack()
    gameinput0.pack()
    enter.pack()
    root.mainloop()
def main():#and goes straight to this
    root.destroy()
    window = Toplevel()
    time.sleep(8)
    gametext0 = Label(window , text = "5")
    gametext1 = Label(window , text = "6")
    gametext2 = Label(window , text = "7")
    gametext3 = Label(window , text = "8")
    gametext4 = Label(window , text = "9")
    gametext5 = Label(window , text = "10")
    gametext0.pack()
    gametext1.pack()
    gametext2.pack()
    gametext3.pack()
    gametext4.pack()
    gametext5.pack()
    window.mainloop()



def start1():
    global root

    root = Toplevel()
    def securitycheck():
        if secCheck.get() == "123":
            print("Lets go!")
            command = gamemain()
        else:
            print("Nope. Invalid.")
    secCheckt = Label(root, text="Please show me your lisence mister:")
    secCheck = Entry(root, width=50, borderwidth=5)
    secCHK = Button(root, text = "Check", command = securitycheck)
    secCheckt.pack()
    secCheck.pack()
    secCHK.pack()
    secCheck.insert(0, "Code")
    root.mainloop()
def close():
    exit()



print("Game")
global root
root = Tk()
root.geometry = "100X100"
buttonA = Button(root, text="START", command=start1)
buttonB = Button(root, text="CLOSE", command=close)
buttonA.pack()
buttonB.pack()
root.mainloop()
Any help Confused
Reply


Messages In This Thread
GUI skips code part - by MLGpotato - Feb-24-2021, 06:39 PM
RE: GUI skips code part - by menator01 - Feb-24-2021, 07:25 PM
RE: GUI skips code part - by deanhystad - Feb-24-2021, 07:46 PM
RE: GUI skips code part - by MLGpotato - Feb-25-2021, 05:59 AM
RE: GUI skips code part - by buran - Feb-27-2021, 11:07 AM
RE: GUI skips code part - by deanhystad - Feb-28-2021, 05:36 AM
RE: GUI skips code part - by buran - Feb-28-2021, 07:55 AM
RE: GUI skips code part - by deanhystad - Feb-28-2021, 11:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Part of code is adding extra new line when saving to text file. lovepeace 9 5,115 Aug-24-2019, 12:52 PM
Last Post: lovepeace

Forum Jump:

User Panel Messages

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