How to use functions defined inside screen?
Posted: Sat Apr 27, 2024 6:50 am
How can I use functions that are inside screens? I tried understanding dragging when I wrote this, and the card_dragged function that is the drag callback works flawlessly, but when it wants to call the function snapcard, I get an error that it is not defined.
I know I can just put the functions outside, but I like my data tidy and grouped.
I know I can just put the functions outside, but I like my data tidy and grouped.
Code: Select all
screen dragtest():
python:
def snapcard(card, slot):
card.snap(slot.x,slot.y)
return
def card_dragged(drags, drop):
if not drop:
return
card = drags[0].drag_name
slot = drop.drag_name
snapcard(drags[0], drop)
return
# insert regular screen stuff