小编Mar*_*ins的帖子

Tkinter:如何让Tkinter刷新并删除最后一行?

问题是:Tkinter中的时钟指针闪烁,因为我使用w.delete,但如果我不使用它,那么时钟指针复制..请帮忙.

import Tkinter as tk; import time
from math import cos,sin,pi
import sys
root=tk.Tk(); root.title("Clock")
w = tk.Canvas(root, width=320, height=320, bg="#456", relief= "sunken", border=10)

w.pack()

size=300
def funA():

    s=time.localtime()[5]
    m=time.localtime()[4]
    h=time.localtime()[3]
    w.update()
        degrees = 6*s
    angle = degrees*pi*2/360
    ox = 165
    oy = 165
    x = ox + size*sin(angle)*0.45
    y = oy - size*cos(angle)*0.45
    t = w.create_line(ox,oy,x,y, fill = "#ffc")

    degrees1 = 6*m
    angle1 = degrees1*pi*2/360
    ox1 = 165
    oy1 = 165
    x1 = ox1 + size*sin(angle1)*0.4
    y1 …
Run Code Online (Sandbox Code Playgroud)

tk-toolkit refresh tkinter auto-update

2
推荐指数
1
解决办法
3385
查看次数

标签 统计

auto-update ×1

refresh ×1

tk-toolkit ×1

tkinter ×1