ผมสร้างFromใหม่ขึ้นมาFromไว้กรอกข้อมูล แล้วทำการกดrun เพื่อ นำค่าที่กรอก มาPrint แต่ไม่แสดง ครับ
ที่ข้อมูลไม่แสดงเกี่ยวกับ From ที่สร้างใหม่ป่าวครับ
รูปแบบการเทส
- 121.JPG (37.42 KiB) Viewed 1747 times
ผลรัน
- แสดงว่าง.JPG (16.4 KiB) Viewed 1747 times
โค้ด: เลือกทั้งหมด
from tkinter import *
def run_Create_Account():
'Create_Account'
cat1, cat2, cat3, cat4=Case_Test_Create_Account()
print('Name:', cat1.get())
print('User:', cat2.get())
print('Password:', cat3.get())
print('Email:', cat4.get())
def Case_Test_Create_Account():
print('Case Create Account')
top2 = Toplevel(gui)
Label(top2, text="Create Account").grid(row=1)
top2.geometry("250x150") # ขนาดframe กว้าง*สูง
top2.title("Case Create Account") # ชื่อframe
Button1 = Button(top2, text='Run', command=run_Create_Account)
Button1.grid(row=1, column=1)
Label1 = Label(top2, text='Name:')
Label1.grid(row=2)
Label1 = Label(top2, text='Username:')
Label1.grid(row=3)
Label1 = Label(top2, text='Password:')
Label1.grid(row=4)
Label1 = Label(top2, text='Email Address:')
Label1.grid(row=5)
cat1 = Entry(top2, textvariable=StringVar())
cat1.grid(row=2, column=1)
cat2 = Entry(top2, textvariable=StringVar())
cat2.grid(row=3, column=1)
cat3 = Entry(top2, textvariable=StringVar())
cat3.grid(row=4, column=1)
cat4 = Entry(top2, textvariable=StringVar())
cat4.grid(row=5, column=1)
return cat1,cat2,cat3,cat4
gui = Tk()
gui.geometry("50x50")
gui.title("MooZii Cart")
Button( text='TEST', command=Case_Test_Create_Account).grid(row=11, column=1)
gui.mainloop()