久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Python 3.0 使用 turtle.onclick

Python 3.0 using turtle.onclick(Python 3.0 使用 turtle.onclick)
本文介紹了Python 3.0 使用 turtle.onclick的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

所以這是我的問題,我必須為我的 CS 課制作一張照片,在海龜中進行估計真的很令人沮喪.我打算使用 .onclick() 來顯示我的位置.

So here is my problem, I have to make a picture for my CS class and it is really frustrating estimating in turtle. I planed to use .onclick() to show me to position.

import turtle as t
def getPos(x,y):
    print("(", x, "," ,y,")")
    return

def main():
    t.onclick(getPos)
    t.mainloop()
main()

海龜文檔似乎說 onclick 將在一個接受兩個變量的函數中傳遞坐標.

The turtle documentation seems to say that the onclick will pass the coordinates in a function that takes in two variables.

http://docs.python.org/3.1/library/turtle.html#turtle.onclick

注意:當我單擊箭頭時它會起作用,但這不是我想要的.我想點擊屏幕上的其他位置來找出我應該將箭頭發送到哪個坐標!

NOTE: It works when I click on the arrow head, but thats not what I want. I want to click some other position on the screen to find out what coordinates I should send the arrow head to!

任何幫助將不勝感激.

推薦答案

好吧,我想出了一個解決辦法.它不是一個完美的解決方案,但效果很好.因為只有當你點擊箭頭時 onclick 才會響應,所以我讓箭頭包含了整個屏幕.然后我把它藏了起來.你需要做的是將鼠標懸停在你想去的位置上,按a",當它變黑時點擊屏幕.然后外殼將顯示您需要的坐標.確保你總是回到 (1000,0).

Alright, I figured out a work around. Its not a perfect solution but it works pretty well. Because onclick will only respond if you click on the arrow head, I made the arrow head encompass the entire screen. Then I hid it. What you need to do is hover over the position you want to go to, press "a" and when it goes black click the screen. The shell will then display the coordinates you need. Make sure you always go back to (1000,0).

import turtle as t

def showTurtle():
    t.st()
    return

def getPos(x,y):
    print("(", x, "," ,y,")")
    return

def hideTurtle(x,y):
    t.ht()
    return

def main():
    t.speed(20)
    t.shapesize(1000,1000)
    t.up()
    t.goto(1000,0)
    t.ht()
    t.onkey(showTurtle,"a")
    t.listen()
    t.onclick(getPos)
    t.onrelease(hideTurtle)
    t.mainloop()
main()

另外,如果我班上的任何人發現這個,我是賓厄姆頓的一名 CS 學生,如果你使用這個,我建議不要留下任何痕跡.教授已經看到了這一點,并且會認出它.

Also, in case anyone from my class finds this, I am a CS student in binghamton and if you use this I recommend leaving no trace. The prof has seen this and will recognize it.

這篇關于Python 3.0 使用 turtle.onclick的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區域周圍繪制一個矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個矩形邊界框中應用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據文本方向檢測圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 亚洲啊v在线 | 99视频在线| 好婷婷网| 久久久久久久久久久久久9999 | 亚洲精品www | 男女羞羞视频网站 | 狠狠躁18三区二区一区 | 99久热在线精品视频观看 | 日本不卡一区二区三区 | 伊人天堂网| 日韩一区二区在线观看视频 | 欧美bondage紧缚视频 | 国产精品久久久久久久久久三级 | 日韩无 | 日韩一二三区视频 | 日本一区二区不卡视频 | 国产有码 | 午夜精品久久久久久久久久久久久 | 亚洲欧美日韩精品久久亚洲区 | 伊人网在线综合 | 精品国产三级 | 亚洲自拍一区在线观看 | 亚洲小说图片 | 亚洲一区二区三区在线视频 | 亚洲444eee在线观看 | 日本精品一区二区三区在线观看视频 | 亚洲成人一二区 | 国产大片黄色 | 欧美一级在线 | 日本精品一区 | 91精品无人区卡一卡二卡三 | 国产精品国产三级国产aⅴ无密码 | 在线观看亚洲专区 | 理论片87福利理论电影 | 在线日韩精品视频 | 午夜av在线 | 免费成人午夜 | 国产精品久久久久av | 欧美综合一区二区 | 亚洲日韩第一页 | 日韩第一夜 |