質問するログイン新規登録

質問編集履歴

2

追記

2019/10/06 01:51

投稿

goki_gottan
goki_gottan

スコア168

title CHANGED
File without changes
body CHANGED
@@ -17,4 +17,89 @@
17
17
  ちなみに、メインではtkinterを使用しており、そのボタン2を押すと上記別スクリプトが起動します。別スクリプトを閉じても[aaaa]は表示されず、メインを閉じると[aaaa]が出るようです。
18
18
 
19
19
  これを、別スクリプトが閉じたら、[aaaa]と表示という風に、mainスクリプトに指示したく思います。
20
- どのようにしたら出せますでしょうか?
20
+ どのようにしたら出せますでしょうか?
21
+
22
+ 追記----------------------------------
23
+ ```
24
+ import tkinter as tk
25
+ import tkinter.ttk as ttk
26
+ import sys,os
27
+
28
+ import system_1
29
+
30
+ def main():
31
+ root1 = tk.Tk()
32
+ root1.title(u"ログイン")
33
+ root1.geometry("600x200")
34
+
35
+ def callback1(event):
36
+ if event.widget["state"] == "disabled":
37
+ return"break"
38
+ else:
39
+ event.widget["state"] = "disabled"
40
+ Button2.config(state="disabled")
41
+ system_1.test()
42
+ print("aaaaa")
43
+ event.widget["state"] = "active"
44
+ Button2.config(state="active")
45
+
46
+ return"break"
47
+
48
+ def callback2(event):
49
+ root1.destroy()
50
+ main()
51
+
52
+ Button1 = tk.Button(root1,text=u'設定', width=15,height=2,font=('Helvetica', '11',"bold"),foreground='#000000', background='#ffaacc')
53
+ Button1.bind("<Button-1>",callback1)
54
+ Button1.place(x=345, y=25)
55
+
56
+ Button2 = tk.Button(root1,text=u'戻る', width=15,height=2,font=('Helvetica', '11',"bold"),foreground='#000000', background='#ffaacc')
57
+ Button2.bind("<Button-1>",callback2)
58
+ Button2.place(x=345, y=125)
59
+
60
+
61
+ root1.mainloop()
62
+
63
+ main()
64
+ ```
65
+ 別ファイル
66
+ ```
67
+ import tkinter as tk
68
+ import tkinter.ttk as ttk
69
+ import pandas as pd
70
+
71
+ typ = [('csvファイル','*.csv')]
72
+ dir = 'C:\'
73
+
74
+ def test():
75
+
76
+ root = tk.Tk()
77
+ root.title(u"Web")
78
+ root.geometry("800x500")
79
+
80
+ #検索文字1-----------------------------------------------------------------
81
+ Static1 = tk.Label(root,text=u'保存先フォルダ', font=('Helvetica', '11',"bold"),width=18,height=1, foreground='#000000', background='#ffaacc')
82
+ Static1.place(x=50, y=65)
83
+
84
+ #エントリー
85
+ EditBox1 = tk.Entry(root,width=50,font=('Helvetica', '11',"bold"),)
86
+ EditBox1.insert(tk.END,r"")
87
+ EditBox1.place(x=240, y=65)
88
+
89
+ def callback1(event):
90
+ root.destroy()
91
+ def callback2(event):
92
+ root.destroy()
93
+
94
+ #OKボタン
95
+ Button1_ = tk.Button(root,text=u'OK', width=10,height=2,font=('Helvetica', '11',"bold"),foreground='#000000', background='#ffaacc')
96
+ Button1_.bind("<Button-1>",callback1)
97
+ Button1_.place(x=390, y=380)
98
+
99
+ #キャンセルボタン---------------------------------------------------------------------------------------------------
100
+ Button2_ = tk.Button(root,text=u'Cancel', width=10,height=2,font=('Helvetica', '11',"bold"),foreground='#000000', background='#ffaacc')
101
+ Button2_.bind("<Button-1>",callback2)
102
+ Button2_.place(x=555, y=380)
103
+
104
+ root.mainloop()
105
+ ```

1

誤記

2019/10/06 01:51

投稿

goki_gottan
goki_gottan

スコア168

title CHANGED
File without changes
body CHANGED
@@ -13,4 +13,8 @@
13
13
  print("aaaa")
14
14
  がでるようにしたいのですが、でません。
15
15
 
16
+ メインのスクリプトを閉じた際に出ます。
17
+ ちなみに、メインではtkinterを使用しており、そのボタン2を押すと上記別スクリプトが起動します。別スクリプトを閉じても[aaaa]は表示されず、メインを閉じると[aaaa]が出るようです。
18
+
19
+ これを、別スクリプトが閉じたら、[aaaa]と表示という風に、mainスクリプトに指示したく思います。
16
20
  どのようにしたら出せますでしょうか?