Seite 1 von 1

Problem mit "tuple"

Verfasst: Freitag 18. Juni 2010, 15:01
von Weltbesiedler

Code: Alles auswählen

import random, pygame, sys

screen = pygame.display.set_mode ((1800, 1000))



colorx = ((100))
colory = ((100))
colorz = ((100))


color = (colorx, colory, colorz)

screen1 = random.randint(1, 255)
screen2 = random.randint(1, 255)
screen3 = random.randint(1, 255)




screen.fill ((screen1, screen2, screen3))

pygame.display.flip()
while True:
    for event in pygame.event.get(): 
       if event.type == pygame.QUIT:
            sys.exit()
       if event.type == pygame.KEYDOWN:
        if event.key == pygame.K_UP:
            Kreis_point = ((900, 500))
            r = 20
            pygame.draw.circle(screen, color, Kreis_point.r , 1)
            pygame.display.update()
Hier sagt dann das Programm:
pygame.draw.circle (screen, color, points)
AttributeError: 'tuple' objekt has no attribute 'r'
Was ist den "tuple" ?

Und was ist der Fehler in meinem Programm?

Re: Problem mit "tuple"

Verfasst: Freitag 18. Juni 2010, 15:05
von rads
Kreis_point = ((900, 500))
r = 20
pygame.draw.circle(screen, color, Kreis_point.r , 1)

was könnte da falsch sein?

Re: Problem mit "tuple"

Verfasst: Freitag 18. Juni 2010, 15:14
von Weltbesiedler
ups!!
Sorry :oops:

Re: Problem mit "tuple"

Verfasst: Freitag 18. Juni 2010, 15:54
von Hyperion
Weltbesiedler hat geschrieben: Was ist den "tuple" ?
Arbeite endlich mal das Tutorial durch - das wird dort alles wunderbar erklärt!

PS: Und es gibt PYTHON-Code Tags ;-)