用法:
turtle.onrelease(fun, btn=1, add=None)
- fun:- 具有兩個參數的函數,將使用畫布上單擊點的坐標調用
- btn:- mouse-button 的編號,默認為 1(鼠標左鍵)
- add:-
True
或者False
- 如果True
, 將添加新的綁定,否則將替換以前的綁定
參數:
將
fun
綁定到此 turtle 上的 mouse-button-release 事件。如果fun
是None
,則刪除現有綁定。>>> class MyTurtle(Turtle): ... def glow(self,x,y): ... self.fillcolor("red") ... def unglow(self,x,y): ... self.fillcolor("") ... >>> turtle = MyTurtle() >>> turtle.onclick(turtle.glow) # clicking on turtle turns fillcolor red, >>> turtle.onrelease(turtle.unglow) # releasing turns it to transparent.
相關用法
- Python turtle.onrelease()用法及代碼示例
- Python turtle.onkey用法及代碼示例
- Python turtle.onscreenclick()用法及代碼示例
- Python turtle.ontimer用法及代碼示例
- Python turtle.onkeypress用法及代碼示例
- Python turtle.ondrag()用法及代碼示例
- Python turtle.ontimer()用法及代碼示例
- Python turtle.onclick用法及代碼示例
- Python turtle.onclick()用法及代碼示例
- Python turtle.onkey()用法及代碼示例
- Python turtle.write_docstringdict()用法及代碼示例
- Python turtle.reset用法及代碼示例
- Python turtle.delay()用法及代碼示例
- Python turtle.write()用法及代碼示例
- Python turtle.getpen()用法及代碼示例
- Python turtle.isvisible用法及代碼示例
- Python turtle.tracer用法及代碼示例
- Python turtle.end_fill()用法及代碼示例
- Python turtle.undo用法及代碼示例
- Python turtle.speed()用法及代碼示例
注:本文由純淨天空篩選整理自python.org大神的英文原創作品 turtle.onrelease。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。