Is There Limitation Of Numbers Of Binding In Tkinter?
Thanks to lots of people's help, I made an tkinter UI that drag/drop the cards. However, I met another big problem. I want to bind the specific cards using line, but the binding do
Solution 1:
It is because you get the wrong card ID:
defupdate_tention(self, tag):
tentions = self.find_withtag(f'card {tag}')
for tention in tentions:
bounded_cards = self.gettags(tention)
card = bounded_cards[0][-1] # get only the last digit, e.g. get "3" from "card 13"
card2= bounded_cards[1][-1] # get only the last digit
x1,y1 = self.get_mid_point(card)
x2,y2 = self.get_mid_point(card2)
self.coords(tention, x1,y1, x2,y2)
self.lower(tention)
It should be:
def update_tention(self, tag):
tentions = self.find_withtag(f'card {tag}')
for tention in tentions:
bounded_cards = self.gettags(tention)
card = bounded_cards[0].split()[-1] # get last number, e.g. "13" from "card 13"
card2= bounded_cards[1].split()[-1] # get last number
x1,y1 = self.get_mid_point(card)
x2,y2 = self.get_mid_point(card2)
self.coords(tention, x1,y1, x2,y2)
self.lower(tention)
Post a Comment for "Is There Limitation Of Numbers Of Binding In Tkinter?"