Skip to content

이벤트 함수 안에 값을 다른 변수에 저장하고 싶어요( I want to save the value to another variable inside the event function.) #1162

@sjune843

Description

@sjune843

해결하고자 하는 문제

이벤트 함수 안에 있는 글로벌 변수안의 값을 함수 밖의 또다른 변수에 저장하고 싶어요.
I want to save the value in the global variable inside the event function to another variable outside the function.

코드 혹은 오류

   여기에 코드를 적어주세요. 

def coordinate(event):
fx = event.x
fy = event.y

global sx
global sy
sx = fx
sy = fy
print (sx,sy)

return sx,sy    

canvas.bind("", start_point,add='')
canvas.bind("", coordinate,add='')

환경

사용중인 운영체제, 언어, 라이브러리의 버전을 적어주세요.
vscode - python

시도해본 방법

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions