回答編集履歴

1

2023/02/11 07:58

投稿

melian
melian

スコア19703

test CHANGED
@@ -7,13 +7,14 @@
7
7
 
8
8
  def fun(i=0):
9
9
  if i < 30:
10
- run(i)
10
+ run(i+1)
11
11
  root.after(500, lambda: fun(i+1))
12
12
 
13
13
  def run(num):
14
14
  text.focus_set()
15
+ text.see(f"{num}.0")
15
16
  text.tag_remove('sel', "1.0", "end")
16
- text.tag_add('sel', f"{num+1}.0", f"{num+1}.end")
17
+ text.tag_add('sel', f"{num}.0", f"{num}.end")
17
18
 
18
19
  #ウェジェット↓
19
20
  btn=tk.Button(root,text="スタート",command=fun)
@@ -21,7 +22,7 @@
21
22
  for i in range(30):
22
23
  text.insert(f"{i+1}.0",f"{i+1} . テキスト\n")
23
24
 
24
- #配置
25
+ #h配置
25
26
  btn.pack()
26
27
  text.pack()
27
28
  root.mainloop()