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

Python 3.0 使用 turtle.onclick

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

問題描述

所以這是我的問題,我必須為我的 CS 課制作一張照片,在海龜中進(jìn)行估計(jì)真的很令人沮喪.我打算使用 .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 將在一個(gè)接受兩個(gè)變量的函數(shù)中傳遞坐標(biāo).

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

注意:當(dāng)我單擊箭頭時(shí)它會(huì)起作用,但這不是我想要的.我想點(diǎn)擊屏幕上的其他位置來找出我應(yīng)該將箭頭發(fā)送到哪個(gè)坐標(biāo)!

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!

任何幫助將不勝感激.

推薦答案

好吧,我想出了一個(gè)解決辦法.它不是一個(gè)完美的解決方案,但效果很好.因?yàn)橹挥挟?dāng)你點(diǎn)擊箭頭時(shí) onclick 才會(huì)響應(yīng),所以我讓箭頭包含了整個(gè)屏幕.然后我把它藏了起來.你需要做的是將鼠標(biāo)懸停在你想去的位置上,按a",當(dāng)它變黑時(shí)點(diǎn)擊屏幕.然后外殼將顯示您需要的坐標(biāo).確保你總是回到 (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()

另外,如果我班上的任何人發(fā)現(xiàn)這個(gè),我是賓厄姆頓的一名 CS 學(xué)生,如果你使用這個(gè),我建議不要留下任何痕跡.教授已經(jīng)看到了這一點(diǎn),并且會(huì)認(rèn)出它.

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.

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

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

相關(guān)文檔推薦

How to draw a rectangle around a region of interest in python(如何在python中的感興趣區(qū)域周圍繪制一個(gè)矩形)
How can I detect and track people using OpenCV?(如何使用 OpenCV 檢測(cè)和跟蹤人員?)
How to apply threshold within multiple rectangular bounding boxes in an image?(如何在圖像的多個(gè)矩形邊界框中應(yīng)用閾值?)
How can I download a specific part of Coco Dataset?(如何下載 Coco Dataset 的特定部分?)
Detect image orientation angle based on text direction(根據(jù)文本方向檢測(cè)圖像方向角度)
Detect centre and angle of rectangles in an image using Opencv(使用 Opencv 檢測(cè)圖像中矩形的中心和角度)
主站蜘蛛池模板: 午夜精品久久久久久久久久久久 | 在线播放亚洲 | 免费视频久久 | 精品99在线 | 九九亚洲| 范冰冰一级做a爰片久久毛片 | 一区二区三区四区国产 | 国产成人精品网站 | 一级大黄 | 久久国产精品免费一区二区三区 | 欧洲亚洲视频 | 亚洲电影免费 | 成人h免费观看视频 | 中文字幕一区在线观看视频 | 国产免费让你躁在线视频 | 久久久久久久一区二区 | 国产精品久久久久久久久久久免费看 | 午夜影院在线观看视频 | 97在线观视频免费观看 | 国产午夜av片 | 91久久精品国产 | 91精品国产91久久久久久吃药 | 日韩在线 | 国产精品一区视频 | 91原创视频 | 毛片免费观看视频 | 天堂久久网 | 午夜视频在线观看一区二区 | 亚洲永久免费 | 精品国产乱码久久久久久1区2区 | 亚洲在线成人 | 欧美精品久久久久 | 亚洲在线 | 久久精品国产久精国产 | 91视频一区二区 | 中文字幕一区二区不卡 | 91美女在线观看 | 国产综合精品一区二区三区 | 久久中文一区二区 | 国产乱码精品一品二品 | 欧美一级欧美一级在线播放 |