tkinter: package for UI design
import tkinter as tk
from tkinter import *
#setup one class.
class setupdialog():
def init(self):
self.root = Tk()
self.root.title=“golden factory setup”
self.root.geometry(“900x200”)
v1 = StringVar()
v1.set('python')
op = OptionMenu(self.root, v1, 'Phone', 'Watch', 'C', 'C++')
op.pack()
def test01():
print('最喜欢的语言是:', v1.get())
click = v1.get() # click return 下拉菜单选中的value
if click == "python": # if select Phone 显示BG/CG 不显示FC/BC
P1.pack()
P2.pack()
W1.pack_forget()
W2.pack_forget()
elif click == "C++":
W1.pack()
W2.pack()
P1.pack_forget()
P2.pack_forget()
Button(self.root, text='确定', command=test01).pack()
def show(self):
self.root.mainloop()
if name == ‘main’:
setupdialog().show()