久久久久久久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 檢測圖像中矩形的中心和角度)
主站蜘蛛池模板: 一区二区小视频 | 黄视频在线播放 | 中文在线免费观看 | 欧美狠狠操 | 久草视频免费在线观看 | av第一页| 国产福利网站 | 亚洲色综合| 国产福利一区二区 | 在线免费观看毛片 | 国产精品成人一区二区三区 | 久热精品视频在线观看 | 成人免费毛片片v | 欧产日产国产69 | 精品亚洲国产成人av制服丝袜 | 免费网站观看www在线观 | 精品在线一区 | 亚洲免费精品 | www.色日本| 日韩黄网| 国产一级免费视频 | 一级片中文字幕 | 色爽 | 亚洲一区中文字幕 | 五月天精品 | 伊人久久艹 | 成人动漫免费观看 | 福利视频网址导航 | 午夜视频免费在线观看 | 欧美国产精品一区二区 | 深夜福利网 | 欧美亚洲一区 | 亚洲欧美视频在线 | 天天干夜夜撸 | 国产欧美一区二区精品性色超碰 | 国产日韩精品一区二区 | 亚洲精品福利 | 四虎官网 | 欧美黑粗大 | 黄色小视频在线观看免费 | 欧美在线播放视频 |