我想知道如何为我的GUI项目调用函数。这是我的main.py文件,其中有一个我想要调用的set_name
函数。例如:a=Thread(target='set_name')
当使用start函数启动set_name
函数时,调用该函数
from tkinter import *
import set_item
root=Tk()
def set_cordinate (event,A):
set_item.Sett.set_name(A)
def get_cordinate(t):
print(t)
b=Button(root,text='Hi',border=0,command=lambda:set.Set.call_modify('Button b clicked')).pack
co=Button(root,text='Get cordinates',command=lambda=set_cordinate((100,200)))
这是set_item.py
from tkinter import *
root=Tk()
class Sett:
def __init__(self):
...
def set_cordinate(self,ele):
e=Button(root,text='Get cordinates').pack()
e.bind('<Button-3>',??)#Here I should call get_cordinate of main.py file and pass ele into it.
#Instead of ?? what should I write can anybody please tell me
def call_modify(self,name):
...
你读过关于模块的python文档了吗?如果没有,那么我想你应该检查一下:-),我想它会帮助你的! Python Modules docs
相关问题 更多 >
编程相关推荐