質問編集履歴

2

追記

2019/10/06 01:51

投稿

goki_gottan
goki_gottan

スコア168

test CHANGED
File without changes
test CHANGED
@@ -37,3 +37,173 @@
37
37
  これを、別スクリプトが閉じたら、[aaaa]と表示という風に、mainスクリプトに指示したく思います。
38
38
 
39
39
  どのようにしたら出せますでしょうか?
40
+
41
+
42
+
43
+ 追記----------------------------------
44
+
45
+ ```
46
+
47
+ import tkinter as tk
48
+
49
+ import tkinter.ttk as ttk
50
+
51
+ import sys,os
52
+
53
+
54
+
55
+ import system_1
56
+
57
+
58
+
59
+ def main():
60
+
61
+ root1 = tk.Tk()
62
+
63
+ root1.title(u"ログイン")
64
+
65
+ root1.geometry("600x200")
66
+
67
+
68
+
69
+ def callback1(event):
70
+
71
+ if event.widget["state"] == "disabled":
72
+
73
+ return"break"
74
+
75
+ else:
76
+
77
+ event.widget["state"] = "disabled"
78
+
79
+ Button2.config(state="disabled")
80
+
81
+ system_1.test()
82
+
83
+ print("aaaaa")
84
+
85
+ event.widget["state"] = "active"
86
+
87
+ Button2.config(state="active")
88
+
89
+
90
+
91
+ return"break"
92
+
93
+
94
+
95
+ def callback2(event):
96
+
97
+ root1.destroy()
98
+
99
+ main()
100
+
101
+
102
+
103
+ Button1 = tk.Button(root1,text=u'設定', width=15,height=2,font=('Helvetica', '11',"bold"),foreground='#000000', background='#ffaacc')
104
+
105
+ Button1.bind("<Button-1>",callback1)
106
+
107
+ Button1.place(x=345, y=25)
108
+
109
+
110
+
111
+ Button2 = tk.Button(root1,text=u'戻る', width=15,height=2,font=('Helvetica', '11',"bold"),foreground='#000000', background='#ffaacc')
112
+
113
+ Button2.bind("<Button-1>",callback2)
114
+
115
+ Button2.place(x=345, y=125)
116
+
117
+
118
+
119
+
120
+
121
+ root1.mainloop()
122
+
123
+
124
+
125
+ main()
126
+
127
+ ```
128
+
129
+ 別ファイル
130
+
131
+ ```
132
+
133
+ import tkinter as tk
134
+
135
+ import tkinter.ttk as ttk
136
+
137
+ import pandas as pd
138
+
139
+
140
+
141
+ typ = [('csvファイル','*.csv')]
142
+
143
+ dir = 'C:\'
144
+
145
+
146
+
147
+ def test():
148
+
149
+
150
+
151
+ root = tk.Tk()
152
+
153
+ root.title(u"Web")
154
+
155
+ root.geometry("800x500")
156
+
157
+
158
+
159
+ #検索文字1-----------------------------------------------------------------
160
+
161
+ Static1 = tk.Label(root,text=u'保存先フォルダ', font=('Helvetica', '11',"bold"),width=18,height=1, foreground='#000000', background='#ffaacc')
162
+
163
+ Static1.place(x=50, y=65)
164
+
165
+
166
+
167
+ #エントリー
168
+
169
+ EditBox1 = tk.Entry(root,width=50,font=('Helvetica', '11',"bold"),)
170
+
171
+ EditBox1.insert(tk.END,r"")
172
+
173
+ EditBox1.place(x=240, y=65)
174
+
175
+
176
+
177
+ def callback1(event):
178
+
179
+ root.destroy()
180
+
181
+ def callback2(event):
182
+
183
+ root.destroy()
184
+
185
+
186
+
187
+ #OKボタン
188
+
189
+ Button1_ = tk.Button(root,text=u'OK', width=10,height=2,font=('Helvetica', '11',"bold"),foreground='#000000', background='#ffaacc')
190
+
191
+ Button1_.bind("<Button-1>",callback1)
192
+
193
+ Button1_.place(x=390, y=380)
194
+
195
+
196
+
197
+ #キャンセルボタン---------------------------------------------------------------------------------------------------
198
+
199
+ Button2_ = tk.Button(root,text=u'Cancel', width=10,height=2,font=('Helvetica', '11',"bold"),foreground='#000000', background='#ffaacc')
200
+
201
+ Button2_.bind("<Button-1>",callback2)
202
+
203
+ Button2_.place(x=555, y=380)
204
+
205
+
206
+
207
+ root.mainloop()
208
+
209
+ ```

1

誤記

2019/10/06 01:51

投稿

goki_gottan
goki_gottan

スコア168

test CHANGED
File without changes
test CHANGED
@@ -28,4 +28,12 @@
28
28
 
29
29
 
30
30
 
31
+ メインのスクリプトを閉じた際に出ます。
32
+
33
+ ちなみに、メインではtkinterを使用しており、そのボタン2を押すと上記別スクリプトが起動します。別スクリプトを閉じても[aaaa]は表示されず、メインを閉じると[aaaa]が出るようです。
34
+
35
+
36
+
37
+ これを、別スクリプトが閉じたら、[aaaa]と表示という風に、mainスクリプトに指示したく思います。
38
+
31
39
  どのようにしたら出せますでしょうか?