当前位置:网站首页>Use turtle to draw buttons
Use turtle to draw buttons
2022-07-31 09:32:00 【Oriental Golden Wood】
#
import turtle as t
# 获取当前屏幕
src=t.getscreen()
# src.setup(480,360)
# src.delay(0)
def goto_s(ct,x,y):
ct.penup()
ct.goto(x,y)
ct.pendown()
# 获取当前鼠标位置
def cursor_x_y(event):
# To determine whether the mouse range is on the button, it is necessary to convert the button to the original coordinates
# Get the current screen size to calculate your own position
# src=t.getscreen()
# print(src.screensize())
print(src.canvheight)
print(event.x)
print(event.y)
# 参数
height=20
width=40
width-=height
r=height//2
if height%2!=0:
print("不可")
if width==0:
print("button is a circle")
out_line_color="red"
button_color="yellow"
x=10
y=10
# 自定义形状
goto_s(t,x,y)
t.hideturtle()
t.speed(100)
t.color(out_line_color,button_color)
t.begin_fill()
t.circle(r,180)
t.forward(width)
t.circle(r,180)
t.forward(width)
t.end_fill()
src.cv.bind("<Motion>",cursor_x_y)
# 顺时针旋转60°
t.done()
边栏推荐
- MySQL 高级(进阶) SQL 语句 (一)
- JSP response,request操作中(中文乱码)-如何解决呢?
- qt在不同的线程中传递自定义结构体参数
- 解决rpc error: code = Unimplemented desc = method CheckLicense not implemented
- Browser usage ratio js radar chart
- Scala基础【seq、set、map、元组、WordCount、队列、并行】
- VMware下安装win10启动后进入Boot Manger界面如何解决
- Come n times - 06. Print the linked list from end to end
- matlab常用符号用法总结
- 来n遍剑指--06. 从尾到头打印链表
猜你喜欢
随机推荐
js滚动条滚动到指定元素
踩水坑2 数据超出long long
loadrunner-Controller负载测试-各模块功能记录01测试场景设计
第五章
通过栗子来学习MySQL高级知识点(学习,复习,面试都可)
第六章
手写promise
六、MFC文档类(单文档和多文档)
Come n times - 07. Rebuild the binary tree
djangoWeb应用框架+MySQL数据4
Redis集群-哨兵模式原理(Sentinel)
js实现2020年元旦倒计时公告牌
loadrunner-controller-目标场景Schedule配置
HTC官方RUU固件提取刷机包rom.zip以及RUU解密教程
postgresql 范围查询比索引查询快吗?
postgresql generate random date, random time
安装gnome-screenshot截图工具
(C语言)程序环境和预处理
Kotlin 优点
MySQL (2)









