[Python] How do I reference the rectangles individually? [closed]

Discussão em 'Python' iniciado por Stack, Março 17, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to make a checklist, the idea is that you can check off the boxes when pressed, but I can't think of a way to reference which box was checked so I can blackout the checkbox

    cursor=Label('|',40,40,size=24)
    Rect(15,32,20,20,fill='white',border='black')

    ###create tasks###
    def onKeyPress(key):
    if(key=='enter'):
    cursor.centerX=40
    cursor.centerY+=25
    box=Rect(15,cursor.centerY-5,20,20,fill=None,border='black')
    elif(key=='space'):
    Label(' ',cursor.centerX,cursor.centerY,size=15)
    cursor.centerX+=10
    elif(key=='backspace'):
    pass
    else:
    Label(key,cursor.centerX,cursor.centerY,size=15)
    cursor.centerX+=10

    def onMousePress(mouseX,mouseY):

    Continue reading...

Compartilhe esta Página