本文介紹了為什么右鍵單擊會在圓圈中心創建一個橙色點?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
為什么kivy中的第一個小部件示例會導致中間出現橙色圓圈右擊畫布時是黃色的,左擊時是純黃色的?
Why does the first widget example in kivy lead to an orange circle in the middle of the yellow one when you right click on the canvas and a pure yellow one when you left click?
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.graphics import Color, Ellipse
class MyPaintWidget(Widget):
def on_touch_down(self, touch):
with self.canvas:
Color(1, 1, 0)
d = 30.
Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))
class MyPaintApp(App):
def build(self):
return MyPaintWidget()
if __name__ == '__main__':
MyPaintApp().run()
推薦答案
要禁用多點觸控仿真,請在導入任何其他 kivy 模塊之前將其添加到包含 main 函數的源文件中:
To disable multi-touch emulation, add this to your source file containing your main function, before any other kivy modules are imported:
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
這篇關于為什么右鍵單擊會在圓圈中心創建一個橙色點?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!