gui.py 48 KB

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