0
어디서부터 시작해야할지 모르기 때문에 코드가 없습니다. 누구든지 버튼이나 그 위젯에 마우스를 가져갈 때 설명 팝업을 만드는 방법을 알고 있습니까? 당신이 클래스 어디에 내에있는 경우Python Tkinter - 버튼에 대한 설명 팝업을 만드는 방법
어디서부터 시작해야할지 모르기 때문에 코드가 없습니다. 누구든지 버튼이나 그 위젯에 마우스를 가져갈 때 설명 팝업을 만드는 방법을 알고 있습니까? 당신이 클래스 어디에 내에있는 경우Python Tkinter - 버튼에 대한 설명 팝업을 만드는 방법
def button_description(button, text, self):
event = None
self.del_search_description = lambda event=event: del_search_description(self)
self.search_description = lambda event=event: search_description_delay(self, text, button)
button.bind("<Enter>", self.search_description)
button.bind("<Leave>", self.del_search_description)
def del_search_description(self, event=None):
try:
self.search_description_top.destroy()
except AttributeError:
pass
return event
def search_description_delay(self, text, button, event=None):
button.after(500 , search_description(self, text, button ,event))
def search_description(self, text, button, event=None):
self.search_description_top = Toplevel()
self.search_description_top.wm_overrideredirect(True)
self.search_description_top_label = Label(self.search_description_top,
text=text,
justify=LEFT, background="gold",
relief=SOLID, borderwidth=1, font='50')
self.search_description_top_label.grid(row=0, column=0)
x = button.winfo_rootx() - int(len(
self.search_description_top_label.cget("text")) * 3.5) + int(button.winfo_width()/2)
y = button.winfo_rooty() + 25
self.search_description_top.geometry("+%s+%s" % (x, y))
return event
를 호출 button_description 기능, 버튼을 제공하거나 다른 위젯, 설명에 넣어 텍스트, 그리고 Tkinter의 코드가 실행되는 클래스 (단어 자체를 전달 귀하의 코드는)
* "어디서부터 시작 해야할지 모르겠다"* - 그럼 여기서 질문 할 준비가되지 않았습니다. – jonrsharpe