代码拉取完成,页面将自动刷新
from tkinter import * # Import tkinter
width = 200
height = 200
radius = 80
class MainGUI:
def __init__(self):
window = Tk() # Create a window
window.title("Fan") # Set a title
self.canvas = Canvas(window, bg = "white", width = width, height = height)
self.canvas.pack()
self.startingAngle = 0
while True:
self.startingAngle += 5
self.displayFan(self.startingAngle)
self.canvas.after(100) # Sleep for 100 milliseconds
self.canvas.update()
window.mainloop() # Create an event loop
def displayFan(self, startingAngle):
self.canvas.delete("fan")
self.canvas.create_arc(width / 2 - radius, height / 2 - radius, width / 2 + radius, height / 2 + radius,
start = self.startingAngle + 0, extent = 30, fill = "red", tags = "fan")
self.canvas.create_arc(width / 2 - radius, height / 2 - radius, width / 2 + radius, height / 2 + radius,
start = self.startingAngle + 90, extent = 30, fill = "red", tags = "fan")
self.canvas.create_arc(width / 2 - radius, height / 2 - radius, width / 2 + radius, height / 2 + radius,
start = self.startingAngle + 180, extent = 30, fill = "red", tags = "fan")
self.canvas.create_arc(width / 2 - radius, height / 2 - radius, width / 2 + radius, height / 2 + radius,
start = self.startingAngle + 270, extent = 30, fill = "red", tags = "fan")
MainGUI()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。