Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
User interface 如何在tkinter python gui中使用鼠标选择多个对象?_User Interface_Python 2.7_Tkinter - Fatal编程技术网

User interface 如何在tkinter python gui中使用鼠标选择多个对象?

User interface 如何在tkinter python gui中使用鼠标选择多个对象?,user-interface,python-2.7,tkinter,User Interface,Python 2.7,Tkinter,我正在尝试使用鼠标选择多个对象,就像在windows中单击并拖动一样。我正在使用python中的tkinter构建这个gui。我正在创建如下代码所示的对象 import Tkinter as tk from Tkinter import * root = Tk() w= Canvas(root, width=800, height=768) w.grid() w.create_line(200,200,300,300, width=3, tags="line1") w.create_oval(

我正在尝试使用鼠标选择多个对象,就像在windows中单击并拖动一样。我正在使用python中的tkinter构建这个gui。我正在创建如下代码所示的对象

import Tkinter as tk
from Tkinter import *

root = Tk()
w= Canvas(root, width=800, height=768)
w.grid()
w.create_line(200,200,300,300, width=3, tags="line1")
w.create_oval(150,100,170,300, fill="red", tags="oval")

mainloop()
我试图做的是,如果我将鼠标拖动到多个对象上,一些def应该返回对象的标记。我怎样才能做到这一点


谢谢

在“按钮按下”事件中保存坐标,然后在“按钮按下”事件中使用画布的“或”方法查找区域所包含的所有项目