1
-
1
+ """
2
+ 本代码由[Tkinter布局助手]生成
3
+ 当前版本:2.5.3
4
+ 官网:https://www.pytk.net/tkinter-helper
5
+ QQ交流群:788392508
6
+ """
2
7
from tkinter import *
3
8
from tkinter .ttk import *
4
9
@@ -7,174 +12,102 @@ class WinGUI(Tk):
7
12
def __init__ (self ):
8
13
super ().__init__ ()
9
14
self .__win ()
10
- self .tk_table_l8cs3hj1 = self .__tk_table_l8cs3hj1 ()
11
- self .tk_frame_l8cs3mqf = Frame_l8cs3mqf (self )
12
- self .tk_label_frame_l8cs3r61 = Frame_l8cs3r61 (self )
13
- self .tk_text_l8cs47v5 = self .__tk_text_l8cs47v5 ()
14
- self .tk_list_box_l8cs4gan = self .__tk_list_box_l8cs4gan ()
15
- self .tk_tabs_l8cs4smw = Frame_l8cs4smw (self )
16
- self .tk_select_box_l8cs5os2 = self .__tk_select_box_l8cs5os2 ()
15
+ self .tk_label_l661vxba = self .__tk_label_l661vxba ()
16
+ self .tk_input_dir = self .__tk_input_dir ()
17
+ self .tk_button_select_dir = self .__tk_button_select_dir ()
18
+ self .tk_button_start = self .__tk_button_start ()
19
+ self .tk_table_list = self .__tk_table_list ()
20
+ self .tk_label_l661zmw9 = self .__tk_label_l661zmw9 ()
21
+ self .tk_label_total_file = self .__tk_label_total_file ()
22
+ self .tk_label_l66208uy = self .__tk_label_l66208uy ()
23
+ self .tk_label_total_page = self .__tk_label_total_page ()
17
24
18
25
def __win (self ):
19
- self .title ("我是标题 ~ Tkinter布局助手 " )
26
+ self .title ("PDF页面统计 " )
20
27
# 设置窗口大小、居中
21
- width = 600
22
- height = 500
28
+ width = 460
29
+ height = 300
23
30
screenwidth = self .winfo_screenwidth ()
24
31
screenheight = self .winfo_screenheight ()
25
32
geometry = '%dx%d+%d+%d' % (width , height ,
26
33
(screenwidth - width ) / 2 , (screenheight - height ) / 2 )
27
34
self .geometry (geometry )
28
35
self .resizable (width = False , height = False )
29
36
30
- def __tk_table_l8cs3hj1 (self ):
37
+ def __tk_label_l661vxba (self ):
38
+ label = Label (self , text = "文件夹" , anchor = "center" )
39
+ label .place (x = 10 , y = 10 , width = 68 , height = 24 )
40
+ return label
41
+
42
+ def __tk_input_dir (self ):
43
+ ipt = Entry (self )
44
+ ipt .place (x = 90 , y = 10 , width = 150 , height = 24 )
45
+ return ipt
46
+
47
+ def __tk_button_select_dir (self ):
48
+ btn = Button (self , text = "选择文件夹" )
49
+ btn .place (x = 250 , y = 10 , width = 110 , height = 24 )
50
+ return btn
51
+
52
+ def __tk_button_start (self ):
53
+ btn = Button (self , text = "开始统计" )
54
+ btn .place (x = 370 , y = 10 , width = 80 , height = 24 )
55
+ return btn
56
+
57
+ def __tk_table_list (self ):
31
58
# 表头字段 表头宽度
32
- columns = {"ID" : 50 , "网站名 " : 100 , "地址 " : 300 }
59
+ columns = {"ID" : 88 , "字段#1 " : 132 , "字段#2 " : 220 }
33
60
# 初始化表格 表格是基于Treeview,tkinter本身没有表格。show="headings" 为隐藏首列。
34
61
tk_table = Treeview (self , show = "headings" , columns = list (columns ))
35
62
for text , width in columns .items (): # 批量设置列属性
36
63
tk_table .heading (text , text = text , anchor = 'center' )
37
64
tk_table .column (text , anchor = 'center' , width = width ,
38
65
stretch = False ) # stretch 不自动拉伸
39
66
40
- data = [
41
- [1 , "github" , "https://github.com/iamxcd/tkinter-helper" ],
42
- [2 , "演示地址" , "https://www.pytk.net/tkinter-helper" ]
43
- ]
44
-
45
- # 导入初始数据
46
- for values in data :
47
- tk_table .insert ('' , END , values = values )
48
-
49
- tk_table .place (x = 30 , y = 420 , width = 450 , height = 70 )
67
+ # 插入数据示例
68
+ # data = [
69
+ # [1, "github", "https://github.com/iamxcd/tkinter-helper"],
70
+ # [2, "演示地址", "https://www.pytk.net/tkinter-helper"]
71
+ # ]
72
+ #
73
+ # # 导入初始数据
74
+ # for values in data:
75
+ # tk_table.insert('', END, values=values)
76
+
77
+ tk_table .place (x = 10 , y = 50 , width = 440 , height = 200 )
50
78
return tk_table
51
79
52
- def __tk_text_l8cs47v5 (self ):
53
- text = Text (self )
54
- text .place (x = 450 , y = 50 , width = 150 , height = 100 )
55
- return text
56
-
57
- def __tk_list_box_l8cs4gan (self ):
58
- lb = Listbox (self )
59
- lb .insert (END , "列表框" )
60
- lb .insert (END , "Python" )
61
- lb .insert (END , "Tkinter Helper" )
62
- lb .place (x = 20 , y = 190 , width = 150 , height = 100 )
63
- return lb
64
-
65
- def __tk_select_box_l8cs5os2 (self ):
66
- cb = Combobox (self , state = "readonly" )
67
- cb ['values' ] = ("下拉选择框" , "Python" , "Tkinter Helper" )
68
- cb .place (x = 10 , y = 320 , width = 150 , height = 24 )
69
- return cb
70
-
71
-
72
- class Frame_l8cs3mqf (Frame ):
73
- def __init__ (self , parent ):
74
- super ().__init__ (parent )
75
- self .__frame ()
76
- self .tk_input_l8cs3oe4 = self .__tk_input_l8cs3oe4 ()
77
- self .tk_radio_button_l8cs4cw1 = self .__tk_radio_button_l8cs4cw1 ()
78
- self .tk_check_button_l8cs4ect = self .__tk_check_button_l8cs4ect ()
79
-
80
- def __frame (self ):
81
- self .place (x = 20 , y = 10 , width = 200 , height = 150 )
82
-
83
- def __tk_input_l8cs3oe4 (self ):
84
- ipt = Entry (self )
85
- ipt .place (x = 30 , y = 40 , width = 150 , height = 24 )
86
- return ipt
87
-
88
- def __tk_radio_button_l8cs4cw1 (self ):
89
- rb = Radiobutton (self , text = "单选框" )
90
- rb .place (x = 10 , y = 80 , width = 80 , height = 24 )
91
- return rb
92
-
93
- def __tk_check_button_l8cs4ect (self ):
94
- cb = Checkbutton (self , text = "多选框" )
95
- cb .place (x = 100 , y = 80 , width = 80 , height = 24 )
96
- return cb
97
-
98
-
99
- class Frame_l8cs3r61 (LabelFrame ):
100
- def __init__ (self , parent ):
101
- super ().__init__ (parent )
102
- self .__frame ()
103
- self .tk_label_l8cs3u95 = self .__tk_label_l8cs3u95 ()
104
- self .tk_button_l8cs3w0i = self .__tk_button_l8cs3w0i ()
105
-
106
- def __frame (self ):
107
- self .configure (text = "标签容器" )
108
- self .place (x = 240 , y = 20 , width = 200 , height = 150 )
109
-
110
- def __tk_label_l8cs3u95 (self ):
111
- label = Label (self , text = "标签" )
112
- label .place (x = 30 , y = 40 , width = 50 , height = 24 )
80
+ def __tk_label_l661zmw9 (self ):
81
+ label = Label (self , text = "文件数" , anchor = "center" )
82
+ label .place (x = 10 , y = 260 , width = 50 , height = 24 )
113
83
return label
114
84
115
- def __tk_button_l8cs3w0i (self ):
116
- btn = Button (self , text = "按钮" )
117
- btn .place (x = 130 , y = 30 , width = 50 , height = 24 )
118
- return btn
119
-
120
-
121
- class Frame_l8cs4smw (Notebook ):
122
- def __init__ (self , parent ):
123
- super ().__init__ (parent )
124
- self .__frame ()
125
-
126
- def __frame (self ):
127
-
128
- self .tk_tabs_l8cs4smw_0 = Frame_l8cs4smw_0 (self )
129
- self .add (self .tk_tabs_l8cs4smw_0 , text = "选项卡1" )
130
-
131
- self .tk_tabs_l8cs4smw_1 = Frame_l8cs4smw_1 (self )
132
- self .add (self .tk_tabs_l8cs4smw_1 , text = "选项卡2" )
133
-
134
- self .place (x = 200 , y = 200 , width = 371 , height = 188 )
135
-
136
-
137
- class Frame_l8cs4smw_0 (Frame ):
138
- def __init__ (self , parent ):
139
- super ().__init__ (parent )
140
- self .__frame ()
141
- self .tk_progressbar_l8cs56bp = self .__tk_progressbar_l8cs56bp ()
142
- self .tk_button_l8cs6lpz = self .__tk_button_l8cs6lpz ()
143
-
144
- def __frame (self ):
145
- self .place (x = 200 , y = 200 , width = 371 , height = 188 )
146
-
147
- def __tk_progressbar_l8cs56bp (self ):
148
- progressbar = Progressbar (self , orient = HORIZONTAL )
149
- progressbar .place (x = 20 , y = 110 , width = 150 , height = 24 )
150
- return progressbar
151
-
152
- def __tk_button_l8cs6lpz (self ):
153
- btn = Button (self , text = "按钮" )
154
- btn .place (x = 180 , y = 50 , width = 50 , height = 24 )
155
- return btn
156
-
157
-
158
- class Frame_l8cs4smw_1 (Frame ):
159
- def __init__ (self , parent ):
160
- super ().__init__ (parent )
161
- self .__frame ()
162
- self .tk_button_l8cs5hjl = self .__tk_button_l8cs5hjl ()
85
+ def __tk_label_total_file (self ):
86
+ label = Label (self , text = "0" , anchor = "center" )
87
+ label .place (x = 80 , y = 260 , width = 50 , height = 24 )
88
+ return label
163
89
164
- def __frame (self ):
165
- self .place (x = 200 , y = 200 , width = 371 , height = 188 )
90
+ def __tk_label_l66208uy (self ):
91
+ label = Label (self , text = "总页数" , anchor = "center" )
92
+ label .place (x = 240 , y = 260 , width = 50 , height = 24 )
93
+ return label
166
94
167
- def __tk_button_l8cs5hjl (self ):
168
- btn = Button (self , text = "按钮 " )
169
- btn .place (x = 90 , y = 90 , width = 50 , height = 24 )
170
- return btn
95
+ def __tk_label_total_page (self ):
96
+ label = Label (self , text = "0" , anchor = "center " )
97
+ label .place (x = 310 , y = 260 , width = 50 , height = 24 )
98
+ return label
171
99
172
100
173
101
class Win (WinGUI ):
174
102
def __init__ (self ):
175
103
super ().__init__ ()
104
+ self .config (menu = self .create_menu ())
176
105
self .__event_bind ()
177
106
107
+ def create_menu (self ):
108
+ menu = Menu (self , tearoff = False )
109
+ return menu
110
+
178
111
def __event_bind (self ):
179
112
pass
180
113
0 commit comments