I'm working on a new project in visual studio as shown in the code below, and the GUI using Tkinter is not working in visual studio. This is my first time using visual studio and I can't seem to find why it won't work.
from tkinter import *
import tkinter as ttk
#import os #not needed
root = Tk()
#Setting up the window
root.geometry("250x100")
root.resizable(width=False, height=False)#Disables user to resize window
root.title("Login")
#Temp "DataBase"
users=[("josh","python")] #<<<here ''josh'' is user and ''python'' i5s password
admins=[("josh1","python1")]
# Login and signup function
def login(): #login function
if (t1.get(),t2.get())in users: #Temp for testing
root.destroy()
import MainWindow
# os.system("MainWindow") #does not work
print("welcome")
elif (t1.get(),t2.get())in admins: #Temp for testing
root.destroy()
import AdminMainWindow
# os.system("AdminMainWindow") #does not work
print("welcome Admin")
else:
error.config(text="Invalid username or password")
def signup(): #signup function
root.destroy
import SignupWindow
# os.system("SignupWindow") #does not work
#arranging display varables
top = Frame(root)
bottom = Frame(root)
top.pack(side=TOP, fill=BOTH, expand=True)
bottom.pack(side=BOTTOM, fill=BOTH, expand=True)
#error placement and font
error = Label(root, font=("blod",10))
error.place(x=40,y=55)
#input display setup
l1 = Label(root,text="Username:")
l2 = Label(root,text="Password:")
t1 = Entry(root, textvariable=StringVar())
t2 = Entry(root, show="*", textvariable=StringVar())
b1 = Button(root,text="Login", command=login)
b2 = Button(root,text="Signup", command=signup)
#organising
l1.pack(in_=top, side=LEFT)
t1.pack(in_=top, side=LEFT)
l2.pack(side=LEFT,)
t2.pack(side=LEFT,)
b1.pack(in_=top, side=BOTTOM)
b2.pack(in_=bottom, side=BOTTOM)
#end of Tk loop
root.mainloop()
It comes up with the python command line and says press any key to continue.
I also looked online and they all say it because people don't end the Tk loop, but I have.