gui.py 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296
  1. import os
  2. import tkinter
  3. from tkinter.scrolledtext import ScrolledText
  4. import tkinter.messagebox
  5. from tkinter.filedialog import askopenfilename, asksaveasfilename, askdirectory
  6. import chardet
  7. import webbrowser
  8. from machinelearning import controller
  9. calculation_list = []
  10. calculation_method = []
  11. PATH = os.getcwd()
  12. sheet_list = []
  13. merge_list = []
  14. learner_controller = controller.MachineLearner()
  15. SCREEN = tkinter.Tk()
  16. gui_width = 13 # 标准宽度
  17. gui_height = 2
  18. row = 0
  19. column = 0
  20. bg_color = "#FFFAFA" # 主颜色
  21. botton_color = "#FFFAFA" # 按钮颜色
  22. word_color = "#000000" # 文字颜色
  23. SCREEN["bg"] = bg_color
  24. FONT = ("黑体", 11) # 设置字体
  25. def machine_learning():
  26. global SCREEN
  27. SCREEN.mainloop()
  28. def add_reverse_fast_fourier2(): # 添加Lenear的核心
  29. add_leaner("[2]Reverse_Fast_Fourier")
  30. def add_reverse_fast_fourier(): # 添加Lenear的核心
  31. add_leaner("Reverse_Fast_Fourier")
  32. def add_fast_fourier(): # 添加Lenear的核心
  33. add_leaner("Fast_Fourier")
  34. def curve_fitting():
  35. file_dir = askopenfilename(title="导入参数")
  36. with open(file_dir, "r") as f:
  37. learner_controller.add_curve_fitting(f.read())
  38. update_leaner()
  39. def show_clustering_score():
  40. show_score(2)
  41. def show_regression_score():
  42. show_score(1)
  43. def show_class_score():
  44. show_score(0)
  45. def show_score(func):
  46. learner = get_learner(True)
  47. save_dir = askdirectory(title="选择保存位置")
  48. data = learner_controller.model_evaluation(
  49. learner, save_dir, get_name(False, True), get_name(False, False), func
  50. )
  51. webbrowser.open(data[0])
  52. webbrowser.open(data[1]) # 还可以打开文件管理器
  53. update_sheet_box()
  54. def calculation():
  55. global calculation_list, calculation_method, calculation_type
  56. func = calculation_type.get()
  57. if len(calculation_list) == 2 and 1 in calculation_method:
  58. learner_controller.calculation_matrix(
  59. calculation_list, calculation_method, func
  60. )
  61. update_sheet_box()
  62. def add_calculation_core(num, type_):
  63. global calculation_list, calculation_method
  64. if len(calculation_list) == 2:
  65. del calculation_list[0]
  66. del calculation_method[0]
  67. calculation_list.append(num)
  68. calculation_method.append(type_)
  69. def update_calculation_box():
  70. global calculation_list, calculation_method, calculation_box
  71. calculation_box.delete(0, tkinter.END)
  72. a = ["第一参数", "第二参数"]
  73. b = ["参数", "矩阵"]
  74. calculation_box.insert(
  75. tkinter.END,
  76. *[
  77. f"{a[i]} {calculation_list[i]} {b[calculation_method[i]]}"
  78. for i in range(len(calculation_list))
  79. ],
  80. )
  81. def add_calculation_number():
  82. global calculation_box, calculation_type, value
  83. num = eval(value.get(), {})
  84. add_calculation_core(num, 0)
  85. update_calculation_box()
  86. def add_calculation_object():
  87. name = get_name()
  88. add_calculation_core(name, 1)
  89. update_calculation_box()
  90. def del_leaner():
  91. learn = get_learner(True)
  92. set_learne = get_learner(False) # 获取学习器Learner
  93. if set_learne != learn:
  94. learner_controller.del_leaner(learn)
  95. update_leaner()
  96. def global_seeting():
  97. global global_settings
  98. args = [bool(i.get()) for i in global_settings]
  99. controller.set_global(*args)
  100. def reshape():
  101. global learner_controller, processing_type, shape
  102. numpy_shape = eval(f"[{shape.get()}]")[0]
  103. learner_controller.reshape(get_name(), numpy_shape)
  104. update_sheet_box()
  105. def transpose():
  106. global learner_controller, processing_type, shape
  107. try:
  108. func = eval(f"[{shape.get()}]")
  109. except BaseException:
  110. func = None
  111. learner_controller.transpose(get_name(), func)
  112. update_sheet_box()
  113. def del_ndim():
  114. global learner_controller
  115. learner_controller.del_ndim(get_name())
  116. update_sheet_box()
  117. def reval():
  118. global learner_controller, processing_type
  119. reval_type = processing_type.get()
  120. learner_controller.reval(get_name(), reval_type)
  121. update_sheet_box()
  122. def two_split():
  123. global learner_controller, processing_type, shape
  124. split_type = processing_type.get()
  125. learner_controller.two_split(get_name(), shape.get(), split_type)
  126. update_sheet_box()
  127. def split():
  128. global learner_controller, processing_type, shape
  129. split_type = processing_type.get()
  130. try:
  131. split_shape_list = eval(f"[{shape.get()}]", {})[0]
  132. except BaseException:
  133. split_shape_list = 2
  134. learner_controller.split(get_name(), split_shape_list, split_type)
  135. update_sheet_box()
  136. def merge():
  137. global merge_list, learner_controller, processing_type
  138. if len(merge_list) < 1:
  139. return False
  140. merge_type = processing_type.get()
  141. learner_controller.merge(merge_list, merge_type)
  142. update_sheet_box()
  143. def update_merge_box():
  144. global merge_list, merge_box
  145. merge_box.delete(0, tkinter.END)
  146. merge_box.insert(tkinter.END, *merge_list)
  147. def merge_del():
  148. global merge_list, merge_box
  149. del merge_list[merge_box.curselection()[0]]
  150. update_merge_box()
  151. def merge_add():
  152. global merge_list
  153. name = get_name()
  154. merge_list.append(name)
  155. update_merge_box()
  156. def visualization_results():
  157. learner = get_learner(True)
  158. save_dir = askdirectory(title="选择保存位置")
  159. data = learner_controller.model_visualization(learner, save_dir)
  160. webbrowser.open(data[0])
  161. webbrowser.open(data[1]) # 还可以打开文件管理器
  162. update_sheet_box()
  163. def get_learner_parameters():
  164. global learner_parameters
  165. return learner_parameters.get("0.0", tkinter.END)
  166. def score_learner():
  167. learner = get_learner()
  168. socore = learner_controller.score(
  169. get_name(False, True), get_name(False, False), learner
  170. )
  171. tkinter.messagebox.showinfo("测试完成", f"针对测试数据评分结果为:{socore}")
  172. def predict_learner():
  173. learner = get_learner()
  174. data = learner_controller.predict(get_name(False, True), learner)
  175. title = f"CoTan数据处理 学习器:{learner}"
  176. creat_text_sheet(data, title)
  177. update_sheet_box()
  178. def fit_learner():
  179. learner = get_learner()
  180. try:
  181. split = float(data_split.get())
  182. if split < 0 or 1 < split:
  183. raise Exception
  184. except BaseException:
  185. split = 0.3
  186. socore = learner_controller.fit_model(
  187. get_name(False, True),
  188. get_name(False, False),
  189. learner,
  190. Text=get_learner_parameters(),
  191. split=split,
  192. )
  193. tkinter.messagebox.showinfo(
  194. "训练完成",
  195. f"针对训练数据({(1 - split) * 100}%)评分结果为:{socore[0]}\n"
  196. f"针对测试数据评分({split * 100}%)结果为:{socore[1]}",
  197. )
  198. def set_x_data():
  199. global x_data
  200. x_data.set(get_name())
  201. def set_y_data():
  202. global y_data
  203. y_data.set(get_name())
  204. def set_learner():
  205. global learner_output
  206. learner_output.set(get_learner(True))
  207. def get_learner(return_box=False):
  208. global learn_dict, learner_box, learner_output
  209. if return_box:
  210. try:
  211. return list(learn_dict.keys())[learner_box.curselection()[0]]
  212. except BaseException:
  213. try:
  214. return list(learn_dict.keys)[0]
  215. except BaseException:
  216. return get_learner(False)
  217. else:
  218. try:
  219. return learner_output.get()
  220. except BaseException:
  221. return None
  222. def add_statistics(): # 添加Lenear的核心
  223. add_leaner("Statistics")
  224. def add_correlation():
  225. add_leaner("Correlation")
  226. def add_matrix_scatter():
  227. add_leaner("MatrixScatter")
  228. def add_view_data():
  229. learner_controller.add_view_data(get_learner(), parameters=get_learner_parameters())
  230. update_leaner()
  231. def add_cluster_tree():
  232. add_leaner("ClusterTree")
  233. def add_feature_y_x():
  234. add_leaner("FeatureY-X")
  235. def add_numpy_to_heatmap():
  236. add_leaner("HeatMap")
  237. def add_predictive_heatmap_more(): # 添加Lenear的核心
  238. learner_controller.add_predictive_heat_map_more(
  239. get_learner(), parameters=get_learner_parameters()
  240. )
  241. update_leaner()
  242. def add_predictive_heatmap(): # 添加Lenear的核心
  243. learner_controller.add_predictive_heat_map(
  244. get_learner(), parameters=get_learner_parameters()
  245. )
  246. update_leaner()
  247. def add_feature_scatter_class_all():
  248. add_leaner("FeatureScatterClass_all")
  249. def add_feature_scatter_all():
  250. add_leaner("FeatureScatter_all")
  251. def add_feature_scatter_class():
  252. add_leaner("FeatureScatterClass")
  253. def add_feature_scatter():
  254. add_leaner("FeatureScatter")
  255. def add_class_bar():
  256. add_leaner("ClassBar")
  257. def add_dbscan():
  258. add_leaner("DBSCAN")
  259. def add_agglomerative():
  260. add_leaner("Agglomerative")
  261. def add_k_means():
  262. add_leaner("k-means")
  263. def add_mlp_class():
  264. add_leaner("MLP_class")
  265. def add_mlp():
  266. add_leaner("MLP")
  267. def add_svr():
  268. add_leaner("SVR")
  269. def add_svc():
  270. add_leaner("SVC")
  271. def add_gradient_tree():
  272. add_leaner("GradientTree")
  273. def add_gradient_tree_class():
  274. add_leaner("GradientTree_class")
  275. def add_tsne():
  276. add_leaner("t-SNE")
  277. def add_nmf():
  278. add_leaner("NMF")
  279. def add_lda():
  280. add_leaner("LDA")
  281. def add_kpca():
  282. add_leaner("KPCA")
  283. def add_rpca():
  284. add_leaner("RPCA")
  285. def add_pca():
  286. add_leaner("PCA")
  287. def add_missed():
  288. add_leaner("Missed")
  289. def add_label():
  290. add_leaner("Label")
  291. def add_one_hot_encoder():
  292. add_leaner("OneHotEncoder")
  293. def add_discretization():
  294. add_leaner("Discretization")
  295. def add_binarizer():
  296. add_leaner("Binarizer")
  297. def add_regularization():
  298. add_leaner("Regularization")
  299. def add_fuzzy_quantization():
  300. add_leaner("Fuzzy_quantization")
  301. def add_mapzoom():
  302. add_leaner("Mapzoom")
  303. def add_sigmod_scaler():
  304. add_leaner("sigmodScaler")
  305. def add_decimal_scaler():
  306. add_leaner("decimalScaler")
  307. def add_atan_scaler():
  308. add_leaner("atanScaler")
  309. def add_log_scaler():
  310. add_leaner("LogScaler")
  311. def add_min_max_scaler():
  312. add_leaner("MinMaxScaler")
  313. def add_z_score():
  314. add_leaner("Z-Score")
  315. def add_forest():
  316. add_leaner("Forest")
  317. def add_forest_class():
  318. add_leaner("Forest_class")
  319. def add_tree_class():
  320. add_leaner("Tree_class")
  321. def add_tree():
  322. add_leaner("Tree")
  323. def add_select_k_best():
  324. add_leaner("SelectKBest")
  325. def add_knn_class():
  326. add_leaner("Knn_class")
  327. def add_logistic_regression():
  328. add_leaner("LogisticRegression")
  329. def add_lasso():
  330. add_leaner("Lasso")
  331. def add_variance():
  332. add_leaner("Variance")
  333. def add_knn():
  334. add_leaner("Knn")
  335. def add_ridge():
  336. add_leaner("Ridge")
  337. def add_line():
  338. add_leaner("Line")
  339. def add_select_from_model(): # 添加Lenear的核心
  340. learner_controller.add_select_from_model(
  341. get_learner(), parameters=get_learner_parameters()
  342. )
  343. update_leaner()
  344. def add_leaner(learner_type): # 添加Lenear的核心
  345. learner_controller.add_learner(learner_type, parameters=get_learner_parameters())
  346. update_leaner()
  347. def update_leaner():
  348. global learn_dict, learner_box
  349. learn_dict = learner_controller.return_learner()
  350. learner_box.delete(0, tkinter.END)
  351. learner_box.insert(tkinter.END, *learn_dict.keys())
  352. def to_html_one():
  353. global PATH, to_html_type
  354. html_dir = f"{PATH}/$Show_Sheet.html"
  355. try:
  356. name = get_name()
  357. if name is None:
  358. raise Exception
  359. learner_controller.to_html_one(name, html_dir)
  360. webbrowser.open(html_dir)
  361. except BaseException:
  362. # pass
  363. raise
  364. def to_html():
  365. global PATH, to_html_type
  366. html_dir = f"{PATH}/$Show_Sheet.html"
  367. try:
  368. name = get_name()
  369. if name is None:
  370. raise Exception
  371. learner_controller.to_html(name, html_dir, to_html_type.get())
  372. webbrowser.open(html_dir)
  373. except BaseException:
  374. pass
  375. def to_csv():
  376. global SCREEN, sep, encoding, dtype_str
  377. save_dir = asksaveasfilename(title="选择保存的CSV", filetypes=[("CSV", ".csv")])
  378. csv_sep = sep.get()
  379. name = get_name()
  380. learner_controller.to_csv(save_dir, name, csv_sep)
  381. update_sheet_box()
  382. def add_csv():
  383. global SCREEN, sep, encoding, dtype_str, sheet_name
  384. csv_dir = askopenfilename(title="选择载入的CSV", filetypes=[("CSV", ".csv")])
  385. if csv_dir == "":
  386. return False
  387. sep = sep.get()
  388. encoding = encoding.get()
  389. must_str = bool(dtype_str.get())
  390. name = sheet_name.get().replace(" ", "")
  391. if name == "":
  392. name = os.path.splitext(os.path.split(csv_dir)[1])[0]
  393. if encoding == "":
  394. with open(csv_dir, "rb") as f:
  395. encoding = chardet.detect(f.read())["encoding"]
  396. if sep == "":
  397. sep = ","
  398. learner_controller.read_csv(
  399. csv_dir, name, encoding, must_str, sep,
  400. )
  401. update_sheet_box()
  402. def add_python():
  403. global SCREEN, sep, encoding, dtype_str
  404. python_dir = askopenfilename(
  405. title="选择载入的py", filetypes=[("Python", ".py"), ("Txt", ".txt")]
  406. )
  407. name = sheet_name.get().replace(" ", "")
  408. if name == "":
  409. name = os.path.splitext(os.path.split(python_dir)[1])[0]
  410. with open(python_dir, "r") as f:
  411. learner_controller.add_python(f.read(), name)
  412. update_sheet_box()
  413. def get_name(get_from_box=True, is_x_data=True): # 获得名字统一接口
  414. global sheet_list, sheet_box, x_data
  415. if get_from_box:
  416. try:
  417. return sheet_list[sheet_box.curselection()[0]]
  418. except BaseException:
  419. try:
  420. return sheet_list[0]
  421. except BaseException:
  422. return None
  423. else:
  424. try:
  425. if is_x_data:
  426. return x_data.get()
  427. else:
  428. return y_data.get()
  429. except BaseException:
  430. return None
  431. def update_sheet_box():
  432. global SCREEN, sheet_box, sheet_list
  433. sheet_list = list(learner_controller.get_form().keys())
  434. sheet_box.delete(0, tkinter.END)
  435. sheet_box.insert(tkinter.END, *sheet_list)
  436. def creat_text_sheet(data, name):
  437. global bg_color
  438. new_top = tkinter.Toplevel(bg=bg_color)
  439. new_top.title(name)
  440. new_top.geometry("+10+10") # 设置所在位置
  441. text = ScrolledText(new_top, font=("黑体", 13), height=50)
  442. text.pack(fill=tkinter.BOTH)
  443. text.insert("0.0", data)
  444. text.config(state=tkinter.DISABLED)
  445. new_top.resizable(width=False, height=False)
  446. SCREEN.title("CoTan机器学习")
  447. SCREEN.resizable(width=False, height=False)
  448. SCREEN.geometry("+10+10") # 设置所在位置
  449. tkinter.Button(
  450. SCREEN,
  451. bg=botton_color,
  452. fg=word_color,
  453. text="导入CSV",
  454. command=add_csv,
  455. font=FONT,
  456. width=gui_width,
  457. height=gui_height,
  458. ).grid(
  459. column=column,
  460. row=row,
  461. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  462. )
  463. tkinter.Button(
  464. SCREEN,
  465. bg=botton_color,
  466. fg=word_color,
  467. text="导入Py",
  468. command=add_python,
  469. font=FONT,
  470. width=gui_width,
  471. height=gui_height,
  472. ).grid(
  473. column=column + 1,
  474. row=row,
  475. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  476. )
  477. tkinter.Button(
  478. SCREEN,
  479. bg=botton_color,
  480. fg=word_color,
  481. text="导出CSV",
  482. command=to_csv,
  483. font=FONT,
  484. width=gui_width,
  485. height=gui_height,
  486. ).grid(
  487. column=column + 2,
  488. row=row,
  489. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  490. )
  491. row += 1
  492. tkinter.Label(
  493. SCREEN,
  494. text="表格名称:",
  495. bg=bg_color,
  496. fg=word_color,
  497. font=FONT,
  498. width=gui_width,
  499. height=gui_height,
  500. ).grid(
  501. column=column, row=row
  502. ) # 设置说明
  503. sheet_name = tkinter.Entry(SCREEN, width=gui_width)
  504. sheet_name.grid(
  505. column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
  506. )
  507. row += 1
  508. tkinter.Button(
  509. SCREEN,
  510. bg=botton_color,
  511. fg=word_color,
  512. text="删除表格",
  513. font=FONT,
  514. width=gui_width,
  515. height=gui_height,
  516. ).grid(
  517. column=column,
  518. row=row,
  519. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  520. )
  521. tkinter.Button(
  522. SCREEN,
  523. bg=botton_color,
  524. fg=word_color,
  525. text="查看表格",
  526. command=to_html,
  527. font=FONT,
  528. width=gui_width,
  529. height=gui_height,
  530. ).grid(
  531. column=column + 1,
  532. row=row,
  533. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  534. )
  535. tkinter.Button(
  536. SCREEN,
  537. bg=botton_color,
  538. fg=word_color,
  539. text="查看单一表格",
  540. command=to_html_one,
  541. font=FONT,
  542. width=gui_width,
  543. height=gui_height,
  544. ).grid(
  545. column=column + 2,
  546. row=row,
  547. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  548. )
  549. row += 1
  550. to_html_type = tkinter.IntVar() # 正,负,0
  551. lable = ["选项卡型", "可移动型", "自适应型"] # 复选框
  552. for i in range(3):
  553. tkinter.Radiobutton(
  554. SCREEN,
  555. bg=bg_color,
  556. fg=word_color,
  557. activebackground=bg_color,
  558. activeforeground=word_color,
  559. selectcolor=bg_color,
  560. text=lable[i],
  561. variable=to_html_type,
  562. value=i,
  563. ).grid(column=column + i, row=row, sticky=tkinter.W)
  564. dtype_str = tkinter.IntVar()
  565. row += 1
  566. tkinter.Label(
  567. SCREEN,
  568. text="编码方式:",
  569. bg=bg_color,
  570. fg=word_color,
  571. font=FONT,
  572. width=gui_width,
  573. height=gui_height,
  574. ).grid(
  575. column=column, row=row
  576. ) # 设置说明
  577. encoding = tkinter.Entry(SCREEN, width=gui_width)
  578. encoding.grid(column=column + 1, row=row, sticky=tkinter.E + tkinter.W)
  579. buttom = tkinter.Checkbutton(
  580. SCREEN,
  581. bg=bg_color,
  582. fg=word_color,
  583. activebackground=bg_color,
  584. activeforeground=word_color,
  585. selectcolor=bg_color,
  586. text="字符串类型",
  587. variable=dtype_str,
  588. )
  589. buttom.grid(column=column + 2, row=row, sticky=tkinter.W)
  590. row += 1
  591. tkinter.Label(
  592. SCREEN,
  593. text="CSV分隔符:",
  594. bg=bg_color,
  595. fg=word_color,
  596. font=FONT,
  597. width=gui_width,
  598. height=gui_height,
  599. ).grid(
  600. column=column, row=row
  601. ) # 设置说明
  602. sep = tkinter.Entry(SCREEN, width=gui_width)
  603. sep.grid(column=column + 1, columnspan=2, row=row, sticky=tkinter.E + tkinter.W)
  604. row += 1
  605. sheet_box = tkinter.Listbox(
  606. SCREEN, width=gui_width * 3, height=gui_height * 10
  607. ) # 显示符号
  608. sheet_box.grid(
  609. column=column,
  610. row=row,
  611. columnspan=3,
  612. rowspan=10,
  613. sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
  614. )
  615. # 422
  616. row += 10
  617. tkinter.Button(
  618. SCREEN,
  619. bg=botton_color,
  620. fg=word_color,
  621. text="添加数据",
  622. command=merge_add,
  623. font=FONT,
  624. width=gui_width,
  625. height=gui_height,
  626. ).grid(
  627. column=column,
  628. row=row,
  629. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  630. )
  631. tkinter.Button(
  632. SCREEN,
  633. bg=botton_color,
  634. fg=word_color,
  635. text="删除数据",
  636. command=merge_del,
  637. font=FONT,
  638. width=gui_width,
  639. height=gui_height,
  640. ).grid(
  641. column=column + 1,
  642. row=row,
  643. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  644. )
  645. tkinter.Button(
  646. SCREEN,
  647. bg=botton_color,
  648. fg=word_color,
  649. text="组合数据",
  650. command=merge,
  651. font=FONT,
  652. width=gui_width,
  653. height=gui_height,
  654. ).grid(
  655. column=column + 2,
  656. row=row,
  657. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  658. )
  659. row += 1
  660. merge_box = tkinter.Listbox(
  661. SCREEN, width=gui_width * 3, height=gui_height * 3
  662. ) # 显示符号
  663. merge_box.grid(
  664. column=column,
  665. row=row,
  666. columnspan=3,
  667. rowspan=3,
  668. sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
  669. )
  670. row += 3
  671. processing_type = tkinter.IntVar() # 正,负,0
  672. lable = ["横向处理", "纵向处理", "深度处理"] # 复选框
  673. for i in range(3):
  674. tkinter.Radiobutton(
  675. SCREEN,
  676. bg=bg_color,
  677. fg=word_color,
  678. activebackground=bg_color,
  679. activeforeground=word_color,
  680. selectcolor=bg_color,
  681. text=lable[i],
  682. variable=processing_type,
  683. value=i,
  684. ).grid(column=column + i, row=row, sticky=tkinter.W)
  685. row += 1
  686. tkinter.Button(
  687. SCREEN,
  688. bg=botton_color,
  689. fg=word_color,
  690. text="数据切片",
  691. command=two_split,
  692. font=FONT,
  693. width=gui_width,
  694. height=gui_height,
  695. ).grid(
  696. column=column,
  697. row=row,
  698. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  699. )
  700. tkinter.Button(
  701. SCREEN,
  702. bg=botton_color,
  703. fg=word_color,
  704. text="数据分割",
  705. command=split,
  706. font=FONT,
  707. width=gui_width,
  708. height=gui_height,
  709. ).grid(
  710. column=column + 1,
  711. row=row,
  712. columnspan=2,
  713. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  714. )
  715. row += 1
  716. tkinter.Label(
  717. SCREEN,
  718. text="重塑形状:",
  719. bg=bg_color,
  720. fg=word_color,
  721. font=FONT,
  722. width=gui_width,
  723. height=gui_height,
  724. ).grid(column=column, row=row)
  725. shape = tkinter.Entry(SCREEN, width=gui_width)
  726. shape.grid(column=column + 1, row=row, sticky=tkinter.E + tkinter.W)
  727. tkinter.Button(
  728. SCREEN,
  729. bg=botton_color,
  730. fg=word_color,
  731. text="矩阵重塑",
  732. command=reshape,
  733. font=FONT,
  734. width=gui_width,
  735. height=gui_height,
  736. ).grid(
  737. column=column + 2,
  738. row=row,
  739. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  740. )
  741. row += 1
  742. tkinter.Button(
  743. SCREEN,
  744. bg=botton_color,
  745. fg=word_color,
  746. text="矩阵伸展",
  747. command=reval,
  748. font=FONT,
  749. width=gui_width,
  750. height=gui_height,
  751. ).grid(
  752. column=column,
  753. row=row,
  754. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  755. )
  756. tkinter.Button(
  757. SCREEN,
  758. bg=botton_color,
  759. fg=word_color,
  760. text="矩阵降维",
  761. command=del_ndim,
  762. font=FONT,
  763. width=gui_width,
  764. height=gui_height,
  765. ).grid(
  766. column=column + 1,
  767. row=row,
  768. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  769. )
  770. tkinter.Button(
  771. SCREEN,
  772. bg=botton_color,
  773. fg=word_color,
  774. text="矩阵转置",
  775. command=transpose,
  776. font=FONT,
  777. width=gui_width,
  778. height=gui_height,
  779. ).grid(
  780. column=column + 2,
  781. row=row,
  782. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  783. )
  784. column += 3
  785. tkinter.Label(SCREEN, text="", bg=bg_color, fg=word_color, font=FONT, width=1).grid(
  786. column=column, row=row
  787. ) # 设置说明
  788. column += 1
  789. row = 0
  790. tkinter.Label(
  791. SCREEN,
  792. text="【机器学习】",
  793. bg=bg_color,
  794. fg=word_color,
  795. font=FONT,
  796. width=gui_width * 3,
  797. height=gui_height,
  798. ).grid(
  799. column=column,
  800. columnspan=3,
  801. row=row,
  802. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  803. ) # 设置说明
  804. row += 1
  805. x_data = tkinter.StringVar()
  806. put = tkinter.Entry(SCREEN, width=gui_width * 2, textvariable=x_data)
  807. put.grid(column=column, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
  808. put["state"] = "readonly"
  809. tkinter.Button(
  810. SCREEN,
  811. bg=botton_color,
  812. fg=word_color,
  813. text="选用X集",
  814. command=set_x_data,
  815. font=FONT,
  816. width=gui_width,
  817. height=gui_height,
  818. ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
  819. y_data = tkinter.StringVar()
  820. row += 1
  821. put = tkinter.Entry(SCREEN, width=gui_width * 2, textvariable=y_data)
  822. put.grid(column=column, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
  823. put["state"] = "readonly"
  824. tkinter.Button(
  825. SCREEN,
  826. bg=botton_color,
  827. fg=word_color,
  828. text="选用Y集",
  829. command=set_y_data,
  830. font=FONT,
  831. width=gui_width,
  832. height=gui_height,
  833. ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
  834. learner_output = tkinter.StringVar()
  835. row += 1
  836. put = tkinter.Entry(SCREEN, width=gui_width * 2, textvariable=learner_output)
  837. put.grid(column=column, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
  838. put["state"] = "readonly"
  839. tkinter.Button(
  840. SCREEN,
  841. bg=botton_color,
  842. fg=word_color,
  843. text="选用学习器",
  844. command=set_learner,
  845. font=FONT,
  846. width=gui_width,
  847. height=gui_height,
  848. ).grid(column=column + 2, row=row, sticky=tkinter.E + tkinter.W)
  849. row += 1
  850. tkinter.Label(
  851. SCREEN,
  852. text="测试数据分割:",
  853. bg=bg_color,
  854. fg=word_color,
  855. font=FONT,
  856. width=gui_width,
  857. height=gui_height,
  858. ).grid(column=column, row=row)
  859. data_split = tkinter.Entry(SCREEN, width=gui_width * 2)
  860. data_split.grid(
  861. column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
  862. )
  863. row += 1
  864. learner_box = tkinter.Listbox(SCREEN, width=gui_width * 3, height=gui_height * 5)
  865. learner_box.grid(
  866. column=column,
  867. row=row,
  868. columnspan=3,
  869. rowspan=5,
  870. sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
  871. )
  872. row += 5
  873. tkinter.Button(
  874. SCREEN,
  875. bg=botton_color,
  876. fg=word_color,
  877. text="导入学习器",
  878. font=FONT,
  879. width=gui_width,
  880. height=gui_height,
  881. ).grid(
  882. column=column,
  883. row=row,
  884. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  885. )
  886. tkinter.Button(
  887. SCREEN,
  888. bg=botton_color,
  889. fg=word_color,
  890. text="查看数据",
  891. command=visualization_results,
  892. font=FONT,
  893. width=gui_width,
  894. height=gui_height,
  895. ).grid(
  896. column=column + 1,
  897. row=row,
  898. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  899. )
  900. tkinter.Button(
  901. SCREEN,
  902. bg=botton_color,
  903. fg=word_color,
  904. text="删除学习器",
  905. command=del_leaner,
  906. font=FONT,
  907. width=gui_width,
  908. height=gui_height,
  909. ).grid(
  910. column=column + 2,
  911. row=row,
  912. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  913. )
  914. row += 1
  915. tkinter.Button(
  916. SCREEN,
  917. bg=botton_color,
  918. fg=word_color,
  919. text="训练机器",
  920. command=fit_learner,
  921. font=FONT,
  922. width=gui_width,
  923. height=gui_height,
  924. ).grid(
  925. column=column,
  926. row=row,
  927. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  928. )
  929. tkinter.Button(
  930. SCREEN,
  931. bg=botton_color,
  932. fg=word_color,
  933. text="测试机器",
  934. command=score_learner,
  935. font=FONT,
  936. width=gui_width,
  937. height=gui_height,
  938. ).grid(
  939. column=column + 1,
  940. row=row,
  941. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  942. )
  943. tkinter.Button(
  944. SCREEN,
  945. bg=botton_color,
  946. fg=word_color,
  947. text="数据预测",
  948. command=predict_learner,
  949. font=FONT,
  950. width=gui_width,
  951. height=gui_height,
  952. ).grid(
  953. column=column + 2,
  954. row=row,
  955. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  956. )
  957. row += 1
  958. tkinter.Button(
  959. SCREEN,
  960. bg=botton_color,
  961. fg=word_color,
  962. text="单一变量特征选择",
  963. command=add_select_k_best,
  964. font=FONT,
  965. width=gui_width,
  966. height=gui_height,
  967. ).grid(
  968. column=column,
  969. row=row,
  970. columnspan=2,
  971. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  972. )
  973. tkinter.Button(
  974. SCREEN,
  975. bg=botton_color,
  976. fg=word_color,
  977. text="映射标准化",
  978. command=add_mapzoom,
  979. font=FONT,
  980. width=gui_width,
  981. height=gui_height,
  982. ).grid(
  983. column=column + 2,
  984. row=row,
  985. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  986. )
  987. row += 1
  988. tkinter.Button(
  989. SCREEN,
  990. bg=botton_color,
  991. fg=word_color,
  992. text="方差特征选择",
  993. command=add_variance,
  994. font=FONT,
  995. width=gui_width,
  996. height=gui_height,
  997. ).grid(
  998. column=column,
  999. row=row,
  1000. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1001. )
  1002. tkinter.Button(
  1003. SCREEN,
  1004. bg=botton_color,
  1005. fg=word_color,
  1006. text="使用学习器筛选",
  1007. command=add_select_from_model,
  1008. font=FONT,
  1009. width=gui_width,
  1010. height=gui_height,
  1011. ).grid(
  1012. column=column + 1,
  1013. row=row,
  1014. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1015. )
  1016. tkinter.Button(
  1017. SCREEN,
  1018. bg=botton_color,
  1019. fg=word_color,
  1020. text="模糊量化标准化",
  1021. command=add_fuzzy_quantization,
  1022. font=FONT,
  1023. width=gui_width,
  1024. height=gui_height,
  1025. ).grid(
  1026. column=column + 2,
  1027. row=row,
  1028. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1029. )
  1030. row += 1
  1031. tkinter.Button(
  1032. SCREEN,
  1033. bg=botton_color,
  1034. fg=word_color,
  1035. text="Z-score",
  1036. command=add_z_score,
  1037. font=FONT,
  1038. width=gui_width,
  1039. height=gui_height,
  1040. ).grid(
  1041. column=column,
  1042. row=row,
  1043. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1044. )
  1045. tkinter.Button(
  1046. SCREEN,
  1047. bg=botton_color,
  1048. fg=word_color,
  1049. text="离差标准化",
  1050. command=add_min_max_scaler,
  1051. font=FONT,
  1052. width=gui_width,
  1053. height=gui_height,
  1054. ).grid(
  1055. column=column + 1,
  1056. row=row,
  1057. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1058. )
  1059. tkinter.Button(
  1060. SCREEN,
  1061. bg=botton_color,
  1062. fg=word_color,
  1063. text="Log变换",
  1064. command=add_log_scaler,
  1065. font=FONT,
  1066. width=gui_width,
  1067. height=gui_height,
  1068. ).grid(
  1069. column=column + 2,
  1070. row=row,
  1071. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1072. )
  1073. row += 1
  1074. tkinter.Button(
  1075. SCREEN,
  1076. bg=botton_color,
  1077. fg=word_color,
  1078. text="atan变换",
  1079. command=add_atan_scaler,
  1080. font=FONT,
  1081. width=gui_width,
  1082. height=gui_height,
  1083. ).grid(
  1084. column=column,
  1085. row=row,
  1086. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1087. )
  1088. tkinter.Button(
  1089. SCREEN,
  1090. bg=botton_color,
  1091. fg=word_color,
  1092. text="小数定标准化",
  1093. command=add_decimal_scaler,
  1094. font=FONT,
  1095. width=gui_width,
  1096. height=gui_height,
  1097. ).grid(
  1098. column=column + 1,
  1099. row=row,
  1100. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1101. )
  1102. tkinter.Button(
  1103. SCREEN,
  1104. bg=botton_color,
  1105. fg=word_color,
  1106. text="Sigmod变换",
  1107. command=add_sigmod_scaler,
  1108. font=FONT,
  1109. width=gui_width,
  1110. height=gui_height,
  1111. ).grid(
  1112. column=column + 2,
  1113. row=row,
  1114. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1115. )
  1116. row += 1
  1117. tkinter.Button(
  1118. SCREEN,
  1119. bg=botton_color,
  1120. fg=word_color,
  1121. text="正则化",
  1122. command=add_regularization,
  1123. font=FONT,
  1124. width=gui_width,
  1125. height=gui_height,
  1126. ).grid(
  1127. column=column,
  1128. row=row,
  1129. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1130. )
  1131. tkinter.Button(
  1132. SCREEN,
  1133. bg=botton_color,
  1134. fg=word_color,
  1135. text="二值离散",
  1136. command=add_binarizer,
  1137. font=FONT,
  1138. width=gui_width,
  1139. height=gui_height,
  1140. ).grid(
  1141. column=column + 1,
  1142. row=row,
  1143. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1144. )
  1145. tkinter.Button(
  1146. SCREEN,
  1147. bg=botton_color,
  1148. fg=word_color,
  1149. text="多值离散",
  1150. command=add_discretization,
  1151. font=FONT,
  1152. width=gui_width,
  1153. height=gui_height,
  1154. ).grid(
  1155. column=column + 2,
  1156. row=row,
  1157. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1158. )
  1159. row += 1
  1160. tkinter.Button(
  1161. SCREEN,
  1162. bg=botton_color,
  1163. fg=word_color,
  1164. text="独热编码",
  1165. command=add_one_hot_encoder,
  1166. font=FONT,
  1167. width=gui_width,
  1168. height=gui_height,
  1169. ).grid(
  1170. column=column,
  1171. row=row,
  1172. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1173. )
  1174. tkinter.Button(
  1175. SCREEN,
  1176. bg=botton_color,
  1177. fg=word_color,
  1178. text="数字编码",
  1179. command=add_label,
  1180. font=FONT,
  1181. width=gui_width,
  1182. height=gui_height,
  1183. ).grid(
  1184. column=column + 1,
  1185. row=row,
  1186. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1187. )
  1188. tkinter.Button(
  1189. SCREEN,
  1190. bg=botton_color,
  1191. fg=word_color,
  1192. text="缺失填充",
  1193. command=add_missed,
  1194. font=FONT,
  1195. width=gui_width,
  1196. height=gui_height,
  1197. ).grid(
  1198. column=column + 2,
  1199. row=row,
  1200. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1201. )
  1202. row += 1
  1203. tkinter.Button(
  1204. SCREEN,
  1205. bg=botton_color,
  1206. fg=word_color,
  1207. text="PCA降维",
  1208. command=add_pca,
  1209. font=FONT,
  1210. width=gui_width,
  1211. height=gui_height,
  1212. ).grid(
  1213. column=column,
  1214. row=row,
  1215. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1216. )
  1217. tkinter.Button(
  1218. SCREEN,
  1219. bg=botton_color,
  1220. fg=word_color,
  1221. text="RPCA降维",
  1222. command=add_rpca,
  1223. font=FONT,
  1224. width=gui_width,
  1225. height=gui_height,
  1226. ).grid(
  1227. column=column + 1,
  1228. row=row,
  1229. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1230. )
  1231. tkinter.Button(
  1232. SCREEN,
  1233. bg=botton_color,
  1234. fg=word_color,
  1235. text="KPCA升维",
  1236. command=add_kpca,
  1237. font=FONT,
  1238. width=gui_width,
  1239. height=gui_height,
  1240. ).grid(
  1241. column=column + 2,
  1242. row=row,
  1243. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1244. )
  1245. row += 1
  1246. tkinter.Button(
  1247. SCREEN,
  1248. bg=botton_color,
  1249. fg=word_color,
  1250. text="LDA降维",
  1251. command=add_lda,
  1252. font=FONT,
  1253. width=gui_width,
  1254. height=gui_height,
  1255. ).grid(
  1256. column=column,
  1257. row=row,
  1258. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1259. )
  1260. tkinter.Button(
  1261. SCREEN,
  1262. bg=botton_color,
  1263. fg=word_color,
  1264. text="NMF降维",
  1265. command=add_nmf,
  1266. font=FONT,
  1267. width=gui_width,
  1268. height=gui_height,
  1269. ).grid(
  1270. column=column + 1,
  1271. row=row,
  1272. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1273. )
  1274. tkinter.Button(
  1275. SCREEN,
  1276. bg=botton_color,
  1277. fg=word_color,
  1278. text="t-SNE",
  1279. command=add_tsne,
  1280. font=FONT,
  1281. width=gui_width,
  1282. height=gui_height,
  1283. ).grid(
  1284. column=column + 2,
  1285. row=row,
  1286. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1287. )
  1288. row += 1
  1289. tkinter.Button(
  1290. SCREEN,
  1291. bg=botton_color,
  1292. fg=word_color,
  1293. text="线性回归",
  1294. command=add_line,
  1295. font=FONT,
  1296. width=gui_width,
  1297. height=gui_height,
  1298. ).grid(
  1299. column=column,
  1300. row=row,
  1301. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1302. )
  1303. tkinter.Button(
  1304. SCREEN,
  1305. bg=botton_color,
  1306. fg=word_color,
  1307. text="岭回归",
  1308. command=add_ridge,
  1309. font=FONT,
  1310. width=gui_width,
  1311. height=gui_height,
  1312. ).grid(
  1313. column=column + 1,
  1314. row=row,
  1315. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1316. )
  1317. tkinter.Button(
  1318. SCREEN,
  1319. bg=botton_color,
  1320. fg=word_color,
  1321. text="Lasso",
  1322. command=add_lasso,
  1323. font=FONT,
  1324. width=gui_width,
  1325. height=gui_height,
  1326. ).grid(
  1327. column=column + 2,
  1328. row=row,
  1329. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1330. )
  1331. row += 1
  1332. tkinter.Button(
  1333. SCREEN,
  1334. bg=botton_color,
  1335. fg=word_color,
  1336. text="逻辑回归",
  1337. command=add_logistic_regression,
  1338. font=FONT,
  1339. width=gui_width,
  1340. height=gui_height,
  1341. ).grid(
  1342. column=column,
  1343. row=row,
  1344. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1345. )
  1346. tkinter.Button(
  1347. SCREEN,
  1348. bg=botton_color,
  1349. fg=word_color,
  1350. text="K邻近预测",
  1351. command=add_knn,
  1352. font=FONT,
  1353. width=gui_width,
  1354. height=gui_height,
  1355. ).grid(
  1356. column=column + 1,
  1357. row=row,
  1358. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1359. )
  1360. tkinter.Button(
  1361. SCREEN,
  1362. bg=botton_color,
  1363. fg=word_color,
  1364. text="K邻近分类",
  1365. command=add_knn_class,
  1366. font=FONT,
  1367. width=gui_width,
  1368. height=gui_height,
  1369. ).grid(
  1370. column=column + 2,
  1371. row=row,
  1372. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1373. )
  1374. row += 1
  1375. tkinter.Button(
  1376. SCREEN,
  1377. bg=botton_color,
  1378. fg=word_color,
  1379. text="梯度回归树回归",
  1380. command=add_gradient_tree,
  1381. font=FONT,
  1382. width=gui_width,
  1383. height=gui_height,
  1384. ).grid(
  1385. column=column,
  1386. row=row,
  1387. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1388. )
  1389. tkinter.Button(
  1390. SCREEN,
  1391. bg=botton_color,
  1392. fg=word_color,
  1393. text="决策树回归",
  1394. command=add_tree,
  1395. font=FONT,
  1396. width=gui_width,
  1397. height=gui_height,
  1398. ).grid(
  1399. column=column + 1,
  1400. row=row,
  1401. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1402. )
  1403. tkinter.Button(
  1404. SCREEN,
  1405. bg=botton_color,
  1406. fg=word_color,
  1407. text="决策树分类",
  1408. command=add_tree_class,
  1409. font=FONT,
  1410. width=gui_width,
  1411. height=gui_height,
  1412. ).grid(
  1413. column=column + 2,
  1414. row=row,
  1415. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1416. )
  1417. row += 1
  1418. tkinter.Button(
  1419. SCREEN,
  1420. bg=botton_color,
  1421. fg=word_color,
  1422. text="梯度回归树分类",
  1423. command=add_gradient_tree_class,
  1424. font=FONT,
  1425. width=gui_width,
  1426. height=gui_height,
  1427. ).grid(
  1428. column=column,
  1429. row=row,
  1430. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1431. )
  1432. tkinter.Button(
  1433. SCREEN,
  1434. bg=botton_color,
  1435. fg=word_color,
  1436. text="随机森林回归",
  1437. command=add_forest,
  1438. font=FONT,
  1439. width=gui_width,
  1440. height=gui_height,
  1441. ).grid(
  1442. column=column + 1,
  1443. row=row,
  1444. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1445. )
  1446. tkinter.Button(
  1447. SCREEN,
  1448. bg=botton_color,
  1449. fg=word_color,
  1450. text="随机森林分类",
  1451. command=add_forest_class,
  1452. font=FONT,
  1453. width=gui_width,
  1454. height=gui_height,
  1455. ).grid(
  1456. column=column + 2,
  1457. row=row,
  1458. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1459. )
  1460. column += 3
  1461. tkinter.Label(SCREEN, text="", bg=bg_color, fg=word_color, font=FONT, width=1).grid(
  1462. column=column, row=row
  1463. ) # 设置说明
  1464. column += 1
  1465. row = 0
  1466. tkinter.Button(
  1467. SCREEN,
  1468. bg=botton_color,
  1469. fg=word_color,
  1470. text="多层感知机回归",
  1471. command=add_mlp,
  1472. font=FONT,
  1473. width=gui_width,
  1474. height=gui_height,
  1475. ).grid(
  1476. column=column,
  1477. row=row,
  1478. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1479. )
  1480. tkinter.Button(
  1481. SCREEN,
  1482. bg=botton_color,
  1483. fg=word_color,
  1484. text="多层感知机分类",
  1485. command=add_mlp_class,
  1486. font=FONT,
  1487. width=gui_width,
  1488. height=gui_height,
  1489. ).grid(
  1490. column=column + 1,
  1491. row=row,
  1492. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1493. )
  1494. tkinter.Button(
  1495. SCREEN,
  1496. bg=botton_color,
  1497. fg=word_color,
  1498. text="随机森林分类",
  1499. command=add_forest_class,
  1500. font=FONT,
  1501. width=gui_width,
  1502. height=gui_height,
  1503. ).grid(
  1504. column=column + 2,
  1505. row=row,
  1506. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1507. )
  1508. row += 1
  1509. tkinter.Button(
  1510. SCREEN,
  1511. bg=botton_color,
  1512. fg=word_color,
  1513. text="支持向量机分类:SVC",
  1514. command=add_svc,
  1515. font=FONT,
  1516. width=gui_width,
  1517. height=gui_height,
  1518. ).grid(
  1519. column=column,
  1520. row=row,
  1521. columnspan=2,
  1522. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1523. )
  1524. tkinter.Button(
  1525. SCREEN,
  1526. bg=botton_color,
  1527. fg=word_color,
  1528. text="回归:SVR",
  1529. command=add_svr,
  1530. font=FONT,
  1531. width=gui_width,
  1532. height=gui_height,
  1533. ).grid(
  1534. column=column + 2,
  1535. row=row,
  1536. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1537. )
  1538. row += 1
  1539. tkinter.Button(
  1540. SCREEN,
  1541. bg=botton_color,
  1542. fg=word_color,
  1543. text="k-means",
  1544. command=add_k_means,
  1545. font=FONT,
  1546. width=gui_width,
  1547. height=gui_height,
  1548. ).grid(
  1549. column=column,
  1550. row=row,
  1551. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1552. )
  1553. tkinter.Button(
  1554. SCREEN,
  1555. bg=botton_color,
  1556. fg=word_color,
  1557. text="凝聚聚类",
  1558. command=add_agglomerative,
  1559. font=FONT,
  1560. width=gui_width,
  1561. height=gui_height,
  1562. ).grid(
  1563. column=column + 1,
  1564. row=row,
  1565. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1566. )
  1567. tkinter.Button(
  1568. SCREEN,
  1569. bg=botton_color,
  1570. fg=word_color,
  1571. text="DBSCAN",
  1572. command=add_dbscan,
  1573. font=FONT,
  1574. width=gui_width,
  1575. height=gui_height,
  1576. ).grid(
  1577. column=column + 2,
  1578. row=row,
  1579. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1580. )
  1581. row += 1
  1582. tkinter.Button(
  1583. SCREEN,
  1584. bg=botton_color,
  1585. fg=word_color,
  1586. text="特征分类图",
  1587. command=add_class_bar,
  1588. font=FONT,
  1589. width=gui_width,
  1590. height=gui_height,
  1591. ).grid(
  1592. column=column,
  1593. row=row,
  1594. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1595. )
  1596. tkinter.Button(
  1597. SCREEN,
  1598. bg=botton_color,
  1599. fg=word_color,
  1600. text="临近特征回归图",
  1601. command=add_feature_scatter,
  1602. font=FONT,
  1603. width=gui_width,
  1604. height=gui_height,
  1605. ).grid(
  1606. column=column + 1,
  1607. row=row,
  1608. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1609. )
  1610. tkinter.Button(
  1611. SCREEN,
  1612. bg=botton_color,
  1613. fg=word_color,
  1614. text="临近特征分类图",
  1615. command=add_feature_scatter_class,
  1616. font=FONT,
  1617. width=gui_width,
  1618. height=gui_height,
  1619. ).grid(
  1620. column=column + 2,
  1621. row=row,
  1622. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1623. )
  1624. row += 1
  1625. tkinter.Button(
  1626. SCREEN,
  1627. bg=botton_color,
  1628. fg=word_color,
  1629. text="所有特征回归图",
  1630. command=add_feature_scatter_all,
  1631. font=FONT,
  1632. width=gui_width,
  1633. height=gui_height,
  1634. ).grid(
  1635. column=column,
  1636. row=row,
  1637. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1638. )
  1639. tkinter.Button(
  1640. SCREEN,
  1641. bg=botton_color,
  1642. fg=word_color,
  1643. text="所有特征分类图",
  1644. command=add_feature_scatter_class_all,
  1645. font=FONT,
  1646. width=gui_width,
  1647. height=gui_height,
  1648. ).grid(
  1649. column=column + 1,
  1650. row=row,
  1651. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1652. )
  1653. tkinter.Button(
  1654. SCREEN,
  1655. bg=botton_color,
  1656. fg=word_color,
  1657. text="临近特征预测图",
  1658. command=add_predictive_heatmap,
  1659. font=FONT,
  1660. width=gui_width,
  1661. height=gui_height,
  1662. ).grid(
  1663. column=column + 2,
  1664. row=row,
  1665. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1666. )
  1667. row += 1
  1668. tkinter.Button(
  1669. SCREEN,
  1670. bg=botton_color,
  1671. fg=word_color,
  1672. text="所有特征预测图",
  1673. command=add_predictive_heatmap_more,
  1674. font=FONT,
  1675. width=gui_width,
  1676. height=gui_height,
  1677. ).grid(
  1678. column=column,
  1679. row=row,
  1680. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1681. )
  1682. tkinter.Button(
  1683. SCREEN,
  1684. bg=botton_color,
  1685. fg=word_color,
  1686. text="矩阵热力图",
  1687. command=add_numpy_to_heatmap,
  1688. font=FONT,
  1689. width=gui_width,
  1690. height=gui_height,
  1691. ).grid(
  1692. column=column + 1,
  1693. row=row,
  1694. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1695. )
  1696. tkinter.Button(
  1697. SCREEN,
  1698. bg=botton_color,
  1699. fg=word_color,
  1700. text="数据y-x散点图",
  1701. command=add_feature_y_x,
  1702. font=FONT,
  1703. width=gui_width,
  1704. height=gui_height,
  1705. ).grid(
  1706. column=column + 2,
  1707. row=row,
  1708. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1709. )
  1710. row += 1
  1711. tkinter.Button(
  1712. SCREEN,
  1713. bg=botton_color,
  1714. fg=word_color,
  1715. text="聚类树状图",
  1716. command=add_cluster_tree,
  1717. font=FONT,
  1718. width=gui_width,
  1719. height=gui_height,
  1720. ).grid(
  1721. column=column,
  1722. row=row,
  1723. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1724. )
  1725. tkinter.Button(
  1726. SCREEN,
  1727. bg=botton_color,
  1728. fg=word_color,
  1729. text="获取数据",
  1730. command=add_view_data,
  1731. font=FONT,
  1732. width=gui_width,
  1733. height=gui_height,
  1734. ).grid(
  1735. column=column + 1,
  1736. row=row,
  1737. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1738. )
  1739. tkinter.Button(
  1740. SCREEN,
  1741. bg=botton_color,
  1742. fg=word_color,
  1743. text="矩阵散点图",
  1744. command=add_matrix_scatter,
  1745. font=FONT,
  1746. width=gui_width,
  1747. height=gui_height,
  1748. ).grid(
  1749. column=column + 2,
  1750. row=row,
  1751. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1752. )
  1753. row += 1
  1754. tkinter.Button(
  1755. SCREEN,
  1756. bg=botton_color,
  1757. fg=word_color,
  1758. text="特征相关性",
  1759. command=add_correlation,
  1760. font=FONT,
  1761. width=gui_width,
  1762. height=gui_height,
  1763. ).grid(
  1764. column=column,
  1765. row=row,
  1766. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1767. )
  1768. tkinter.Button(
  1769. SCREEN,
  1770. bg=botton_color,
  1771. fg=word_color,
  1772. text="曲线拟合",
  1773. command=curve_fitting,
  1774. font=FONT,
  1775. width=gui_width,
  1776. height=gui_height,
  1777. ).grid(
  1778. column=column + 1,
  1779. row=row,
  1780. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1781. )
  1782. tkinter.Button(
  1783. SCREEN,
  1784. bg=botton_color,
  1785. fg=word_color,
  1786. text="快速傅里叶",
  1787. command=add_fast_fourier,
  1788. font=FONT,
  1789. width=gui_width,
  1790. height=gui_height,
  1791. ).grid(
  1792. column=column + 2,
  1793. row=row,
  1794. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1795. )
  1796. row += 1
  1797. tkinter.Button(
  1798. SCREEN,
  1799. bg=botton_color,
  1800. fg=word_color,
  1801. text="数据统计",
  1802. command=add_statistics,
  1803. font=FONT,
  1804. width=gui_width,
  1805. height=gui_height,
  1806. ).grid(
  1807. column=column,
  1808. row=row,
  1809. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1810. )
  1811. tkinter.Button(
  1812. SCREEN,
  1813. bg=botton_color,
  1814. fg=word_color,
  1815. text="双逆向傅里叶",
  1816. command=add_reverse_fast_fourier2,
  1817. font=FONT,
  1818. width=gui_width,
  1819. height=gui_height,
  1820. ).grid(
  1821. column=column + 1,
  1822. row=row,
  1823. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1824. )
  1825. tkinter.Button(
  1826. SCREEN,
  1827. bg=botton_color,
  1828. fg=word_color,
  1829. text="逆向傅里叶",
  1830. command=add_reverse_fast_fourier,
  1831. font=FONT,
  1832. width=gui_width,
  1833. height=gui_height,
  1834. ).grid(
  1835. column=column + 2,
  1836. row=row,
  1837. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1838. )
  1839. row += 1
  1840. tkinter.Button(
  1841. SCREEN,
  1842. bg=botton_color,
  1843. fg=word_color,
  1844. text="分类模型评估",
  1845. command=show_class_score,
  1846. font=FONT,
  1847. width=gui_width,
  1848. height=gui_height,
  1849. ).grid(
  1850. column=column,
  1851. row=row,
  1852. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1853. )
  1854. tkinter.Button(
  1855. SCREEN,
  1856. bg=botton_color,
  1857. fg=word_color,
  1858. text="回归模型评估",
  1859. command=show_regression_score,
  1860. font=FONT,
  1861. width=gui_width,
  1862. height=gui_height,
  1863. ).grid(
  1864. column=column + 1,
  1865. row=row,
  1866. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1867. )
  1868. tkinter.Button(
  1869. SCREEN,
  1870. bg=botton_color,
  1871. fg=word_color,
  1872. text="聚类模型评估",
  1873. command=show_clustering_score,
  1874. font=FONT,
  1875. width=gui_width,
  1876. height=gui_height,
  1877. ).grid(
  1878. column=column + 2,
  1879. row=row,
  1880. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1881. )
  1882. row += 1
  1883. tkinter.Label(
  1884. SCREEN,
  1885. text="【学习器配置】",
  1886. bg=bg_color,
  1887. fg=word_color,
  1888. font=FONT,
  1889. width=gui_width * 3,
  1890. height=gui_height,
  1891. ).grid(
  1892. column=column,
  1893. columnspan=3,
  1894. row=row,
  1895. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1896. ) # 设置说明
  1897. row += 1
  1898. global_settings = []
  1899. lable = ["聚类仅邻近特征", "导出单独页面", "导出表格CSV"] # 复选框
  1900. for i in range(3):
  1901. global_settings.append(tkinter.IntVar())
  1902. tkinter.Checkbutton(
  1903. SCREEN,
  1904. bg=bg_color,
  1905. fg=word_color,
  1906. activebackground=bg_color,
  1907. activeforeground=word_color,
  1908. selectcolor=bg_color,
  1909. text=lable[i],
  1910. variable=global_settings[-1],
  1911. command=global_seeting,
  1912. ).grid(column=column + i, row=row, sticky=tkinter.W)
  1913. row += 1
  1914. lable = ["导出模型", "压缩为tar.gz", "创建新目录"] # 复选框
  1915. for i in range(3):
  1916. global_settings.append(tkinter.IntVar())
  1917. tkinter.Checkbutton(
  1918. SCREEN,
  1919. bg=bg_color,
  1920. fg=word_color,
  1921. activebackground=bg_color,
  1922. activeforeground=word_color,
  1923. selectcolor=bg_color,
  1924. text=lable[i],
  1925. variable=global_settings[-1],
  1926. command=global_seeting,
  1927. ).grid(column=column + i, row=row, sticky=tkinter.W)
  1928. for i in global_settings[1:]:
  1929. i.set(1)
  1930. global_seeting()
  1931. row += 1
  1932. learner_parameters = tkinter.Text(
  1933. SCREEN, width=gui_width * 3, height=gui_height * 6
  1934. )
  1935. learner_parameters.grid(
  1936. column=column,
  1937. row=row,
  1938. columnspan=3,
  1939. rowspan=6,
  1940. sticky=tkinter.E + tkinter.W + tkinter.N + tkinter.S,
  1941. )
  1942. row += 6
  1943. tkinter.Label(
  1944. SCREEN,
  1945. text="【矩阵运算】",
  1946. bg=bg_color,
  1947. fg=word_color,
  1948. font=FONT,
  1949. width=gui_width * 3,
  1950. height=gui_height,
  1951. ).grid(
  1952. column=column,
  1953. columnspan=3,
  1954. row=row,
  1955. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  1956. ) # 设置说明
  1957. row += 1
  1958. calculation_box = tkinter.Listbox(
  1959. SCREEN, width=gui_width * 3, height=gui_height * 1
  1960. )
  1961. calculation_box.grid(
  1962. column=column,
  1963. row=row,
  1964. columnspan=3,
  1965. rowspan=1,
  1966. sticky=tkinter.E + tkinter.W + tkinter.S + tkinter.N,
  1967. )
  1968. row += 1
  1969. tkinter.Label(
  1970. SCREEN,
  1971. text="运算类型:",
  1972. bg=bg_color,
  1973. fg=word_color,
  1974. font=FONT,
  1975. width=gui_width,
  1976. height=gui_height,
  1977. ).grid(column=column, row=row)
  1978. calculation_type = tkinter.Entry(SCREEN, width=gui_width * 2)
  1979. calculation_type.grid(
  1980. column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W
  1981. )
  1982. row += 1
  1983. tkinter.Label(
  1984. SCREEN,
  1985. text="键入参数:",
  1986. bg=bg_color,
  1987. fg=word_color,
  1988. font=FONT,
  1989. width=gui_width,
  1990. height=gui_height,
  1991. ).grid(column=column, row=row)
  1992. value = tkinter.Entry(SCREEN, width=gui_width * 2)
  1993. value.grid(column=column + 1, row=row, columnspan=2, sticky=tkinter.E + tkinter.W)
  1994. row += 1
  1995. tkinter.Button(
  1996. SCREEN,
  1997. bg=botton_color,
  1998. fg=word_color,
  1999. text="选择参数",
  2000. command=add_calculation_object,
  2001. font=FONT,
  2002. width=gui_width,
  2003. height=gui_height,
  2004. ).grid(
  2005. column=column,
  2006. row=row,
  2007. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  2008. )
  2009. tkinter.Button(
  2010. SCREEN,
  2011. bg=botton_color,
  2012. fg=word_color,
  2013. text="键入参数",
  2014. command=add_calculation_number,
  2015. font=FONT,
  2016. width=gui_width,
  2017. height=gui_height,
  2018. ).grid(
  2019. column=column + 1,
  2020. row=row,
  2021. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  2022. )
  2023. tkinter.Button(
  2024. SCREEN,
  2025. bg=botton_color,
  2026. fg=word_color,
  2027. text="矩阵运算",
  2028. command=calculation,
  2029. font=FONT,
  2030. width=gui_width,
  2031. height=gui_height,
  2032. ).grid(
  2033. column=column + 2,
  2034. row=row,
  2035. sticky=tkinter.E + tkinter.W + tkinter.W + tkinter.S + tkinter.N,
  2036. )