回答編集履歴

1

追記: runTask に path を渡す

2020/10/22 04:00

投稿

teamikl
teamikl

スコア8760

test CHANGED
@@ -24,6 +24,8 @@
24
24
 
25
25
  import tkinter as tk
26
26
 
27
+ from functools import partial
28
+
27
29
 
28
30
 
29
31
  root = tk.Tk()
@@ -34,9 +36,9 @@
34
36
 
35
37
 
36
38
 
37
- def runTask():
39
+ def runTask(path):
38
40
 
39
- print("プログラムを実行")
41
+ print("プログラムを実行", path)
40
42
 
41
43
 
42
44
 
@@ -48,7 +50,7 @@
48
50
 
49
51
  buttonB = tk.Button(page2, text="Back", command=page1.tkraise)
50
52
 
51
- buttonC = tk.Button(page2, text="Run", command=runTask)
53
+ buttonC = tk.Button(page2, text="Run", command=partial(runTask, r"PATH"))
52
54
 
53
55
  buttonA.pack()
54
56