Originally Posted by
Vaphell
what do you get from jim.color()? i see that color() is a method setting the color, but i am not convinced it returns what you think it returns.
add some print statement to make things clear eg print( jim.color() )
Inserting a "print(jim.color())" right after jim.stamp() returned:
Code:
('blue', 'blue')
('red', 'red')
('red', 'red')
('red', 'red')
('red', 'red')
('red', 'red')
('red', 'red')
('blue', 'blue')
('red', 'red')
('red', 'red')
I changed my code to
Code:
if jim.color() == ('red', 'red'):
and that worked. And now that I think about it, that makes sense, since the .color() method sets both the pen color and the fill color, which would explain the two values returned each time print(jim.color()) was executed. So if I wanted to do what I had originally planned, I would have to use either .pencolor() or .fillcolor(), since they only hold a single value.
Thanks for the help! This has really helped me learn more about how python works.
Bookmarks