为什么右键单击会在圆心中创建一个橙色的点? [英] Why does right-clicking create an orange dot in the center of the circle?
本文介绍了为什么右键单击会在圆心中创建一个橙色的点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么第一个小部件示例导致中间的橙色圆圈右键单击画布时显示黄色的颜色,而单击鼠标左键时显示纯黄色的颜色?
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模块:
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')
这篇关于为什么右键单击会在圆心中创建一个橙色的点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文