11#coding=utf-8
2-
32#import libs
43import RegDlg_cmd
54import Fun
87import tkinter .ttk
98import tkinter .font
109from PIL import Image ,ImageTk
11-
1210ElementBGArray = {}
1311ElementBGArray_Resize = {}
1412ElementBGArray_IM = {}
15-
1613#Add your Varial Here: (Keep This Line of comments)
1714#Define UI Class
1815class RegDlg :
1916 def __init__ (self ,root ,isTKroot = True ):
20- className = self .__class__ .__name__
21- Fun .G_UIElementArray [className ]= {}
22- Fun .G_ElementBindingDataArray [ className ]= {}
17+ uiName = self .__class__ .__name__
18+ Fun .G_UIElementArray [uiName ]= {}
19+ Fun .G_UIElementUserDataArray [ uiName ]= {}
2320 global ElementBGArray
2421 global ElementBGArray_Resize
2522 global ElementBGArray_IM
26- Fun .AddElement ( className ,'UIClass' ,self )
23+ Fun .Register ( uiName ,'UIClass' ,self )
2724 self .root = root
2825 if isTKroot == True :
2926 root .title ("Form1" )
3027 root .geometry ("454x410" )
3128 Form_1 = tkinter .Canvas (root ,width = 10 ,height = 4 )
3229 Form_1 .place (x = 0 ,y = 0 ,width = 454 ,height = 410 )
3330 Form_1 .configure (bg = "#efefef" )
34- Fun .AddElement ( className ,'root' ,root )
35- Fun .AddElement ( className ,'Form_1' ,Form_1 )
36- Group_1_Variable = Fun .AddElementVariable ( className ,'Group_1' )
31+ Fun .Register ( uiName ,'root' ,root )
32+ Fun .Register ( uiName ,'Form_1' ,Form_1 )
33+ Group_1_Variable = Fun .AddTKVariable ( uiName ,'Group_1' )
3734 Group_1_Variable .set (1 )
3835 #Create the elements of root
3936 Label_2 = tkinter .Label (root ,text = "" ,width = 10 ,height = 4 )
@@ -44,56 +41,55 @@ def __init__(self,root,isTKroot = True):
4441 Label_2 .configure (image = ElementBGArray_IM [2 ])
4542 Label_2_Ft = tkinter .font .Font (family = 'System' , size = 24 ,weight = 'bold' ,slant = 'roman' ,underline = 0 ,overstrike = 0 )
4643 Label_2 .configure (font = Label_2_Ft )
47- Fun .AddElement ( className ,'Label_2' ,Label_2 )
44+ Fun .Register ( uiName ,'Label_2' ,Label_2 )
4845 Label_3 = tkinter .Label (root ,text = "注册信息" ,width = 10 ,height = 4 )
4946 Label_3 .place (x = 150 ,y = 34 ,width = 206 ,height = 45 )
5047 Label_3_Ft = tkinter .font .Font (family = 'System' , size = 29 ,weight = 'bold' ,slant = 'roman' ,underline = 0 ,overstrike = 0 )
5148 Label_3 .configure (font = Label_3_Ft )
52- Fun .AddElement ( className ,'Label_3' ,Label_3 )
49+ Fun .Register ( uiName ,'Label_3' ,Label_3 )
5350 Label_4 = tkinter .Label (root ,text = "姓名" ,width = 10 ,height = 4 )
5451 Label_4 .place (x = 53 ,y = 111 ,width = 100 ,height = 20 )
55- Fun .AddElement ( className ,'Label_4' ,Label_4 )
56- Entry_5_Variable = Fun .AddElementVariable ( className ,'Entry_5' )
52+ Fun .Register ( uiName ,'Label_4' ,Label_4 )
53+ Entry_5_Variable = Fun .AddTKVariable ( uiName ,'Entry_5' )
5754 Entry_5 = tkinter .Entry (root ,textvariable = Entry_5_Variable )
5855 Entry_5 .place (x = 175 ,y = 110 ,width = 120 ,height = 20 )
5956 Entry_5 .configure (relief = "sunken" )
60- Fun .AddElement ( className ,'Entry_5' ,Entry_5 )
57+ Fun .Register ( uiName ,'Entry_5' ,Entry_5 )
6158 Label_6 = tkinter .Label (root ,text = "性别" ,width = 10 ,height = 4 )
6259 Label_6 .place (x = 54 ,y = 146 ,width = 100 ,height = 20 )
63- Fun .AddElement ( className ,'Label_6' ,Label_6 )
60+ Fun .Register ( uiName ,'Label_6' ,Label_6 )
6461 RadioButton_7 = tkinter .Radiobutton (root ,variable = Group_1_Variable ,value = 1 ,text = "男" ,anchor = tkinter .W )
6562 RadioButton_7 .place (x = 173 ,y = 147 ,width = 48 ,height = 20 )
66- Fun .AddElement ( className ,'RadioButton_7' ,RadioButton_7 )
63+ Fun .Register ( uiName ,'RadioButton_7' ,RadioButton_7 )
6764 RadioButton_8 = tkinter .Radiobutton (root ,variable = Group_1_Variable ,value = 2 ,text = "女" ,anchor = tkinter .W )
6865 RadioButton_8 .place (x = 243 ,y = 149 ,width = 48 ,height = 20 )
69- Fun .AddElement ( className ,'RadioButton_8' ,RadioButton_8 )
66+ Fun .Register ( uiName ,'RadioButton_8' ,RadioButton_8 )
7067 Label_9 = tkinter .Label (root ,text = "邮箱" ,width = 10 ,height = 4 )
7168 Label_9 .place (x = 54 ,y = 181 ,width = 100 ,height = 20 )
72- Fun .AddElement ( className ,'Label_9' ,Label_9 )
73- Entry_10_Variable = Fun .AddElementVariable ( className ,'Entry_10' )
69+ Fun .Register ( uiName ,'Label_9' ,Label_9 )
70+ Entry_10_Variable = Fun .AddTKVariable ( uiName ,'Entry_10' )
7471 Entry_10 = tkinter .Entry (root ,textvariable = Entry_10_Variable )
7572 Entry_10 .place (x = 175 ,y = 185 ,width = 195 ,height = 20 )
7673 Entry_10 .configure (relief = "sunken" )
77- Fun .AddElement ( className ,'Entry_10' ,Entry_10 )
74+ Fun .Register ( uiName ,'Entry_10' ,Entry_10 )
7875 Label_11 = tkinter .Label (root ,text = "个人简介" ,width = 10 ,height = 4 )
7976 Label_11 .place (x = 55 ,y = 220 ,width = 100 ,height = 20 )
80- Fun .AddElement ( className ,'Label_11' ,Label_11 )
77+ Fun .Register ( uiName ,'Label_11' ,Label_11 )
8178 Text_12 = tkinter .Text (root )
8279 Text_12 .place (x = 175 ,y = 220 ,width = 240 ,height = 120 )
8380 Text_12 .configure (relief = "sunken" )
84- Fun .AddElement ( className ,'Text_12' ,Text_12 )
81+ Fun .Register ( uiName ,'Text_12' ,Text_12 )
8582 Button_13 = tkinter .Button (root ,text = "确定" ,width = 10 ,height = 4 )
8683 Button_13 .place (x = 176 ,y = 354 ,width = 100 ,height = 28 )
87- Button_13 .configure (command = lambda :RegDlg_cmd .Button_13_onCommand (className ,"Button_13" ))
88- Fun .AddElement ( className ,'Button_13' ,Button_13 )
84+ Button_13 .configure (command = lambda :RegDlg_cmd .Button_13_onCommand (uiName ,"Button_13" ))
85+ Fun .Register ( uiName ,'Button_13' ,Button_13 )
8986 Button_14 = tkinter .Button (root ,text = "取消" ,width = 10 ,height = 4 )
9087 Button_14 .place (x = 310 ,y = 354 ,width = 100 ,height = 28 )
91- Button_14 .configure (command = lambda :RegDlg_cmd .Button_14_onCommand (className ,"Button_14" ))
92- Fun .AddElement ( className ,'Button_14' ,Button_14 )
88+ Button_14 .configure (command = lambda :RegDlg_cmd .Button_14_onCommand (uiName ,"Button_14" ))
89+ Fun .Register ( uiName ,'Button_14' ,Button_14 )
9390 #Inital all element's Data
94- Fun .InitElementData (className )
91+ Fun .InitElementData (uiName )
9592 #Add Some Logic Code Here: (Keep This Line of comments)
96-
9793#Create the root of Kinter
9894if __name__ == '__main__' :
9995 root = tkinter .Tk ()
0 commit comments