Re: [Tutor] help with colormode

2019-04-25 Thread Alan Gauld via Tutor
On 25/04/2019 11:54, Mark Alderson wrote:

> tried screen.colormode(255)

Peter has shown you how to make that work but
there is a wee issue below I need to point out.

> -code-
> from turtle import Turtle
> t = Turtle()
> t.speed(0)
> 
> b = 180
> a = 35
> 
> colormode(255)
> 
> t.color((55,55,55))
> for i in range(200):
> t.circle(i,a)
> t.right(b)
> t.circle(i,a)
> 
> 
> #input('Press any key to continue...')
> 
> -
> 
> ===error===
> Traceback (most recent call last):
>   File "H:\python\snowflake.py", line 9, in 
> screen.colormode(255)
> NameError: name 'screen' is not defined
> ===

The error message clearly does not reflect the code above.
In this case its not too bad but in more complex questions
it is very important that you send the actual code that
generates the error. Otherwise we wind up just guessing
at what might be the problem.

Just something for future reference.

Regards from Stirling,
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with colormode

2019-04-25 Thread Peter Otten
Mark Alderson wrote:

> hi
> 
> Ihave a very small program.  I want to cycle colours.  I cant set the
> colormode from 1 to 255
> 
> tried screen.colormode(255)
> 
> tells me screen is not defined.  the program works without the colormode,
> but i want to use it.
> 
> I just change the a and b variable values to generate new art.
> 
> -code-
> from turtle import Turtle
> t = Turtle()
> t.speed(0)
> 
> b = 180
> 
> a = 35
> 
> colormode(255)
> 
> t.color((55,55,55))
> for i in range(200):
> t.circle(i,a)
> t.right(b)
> t.circle(i,a)
> 
> 
> #input('Press any key to continue...')
> 
> -
> 
> ===error===
> Traceback (most recent call last):
>   File "H:\python\snowflake.py", line 9, in 
> screen.colormode(255)
> NameError: name 'screen' is not defined
> ===

The only name you import is Turtle, so you only have that (and the built-
ins). Fortunately you can get the screen from the Turtle, so:

from turtle import Turtle

ninja = Turtle()
ninja.speed(0)

screen = ninja.screen
screen.colormode(255)

b = 180
a = 35

for i in range(200):
ninja.color((i + 55, 55, 55))
ninja.circle(i, a)
ninja.right(b)
ninja.circle(i, a)

screen.exitonclick()


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] help with colormode

2019-04-25 Thread Mark Alderson
hi

Ihave a very small program.  I want to cycle colours.  I cant set the colormode 
from 1 to 255

tried screen.colormode(255)

tells me screen is not defined.  the program works without the colormode, but i 
want to use it.

I just change the a and b variable values to generate new art.

-code-
from turtle import Turtle
t = Turtle()
t.speed(0)

b = 180

a = 35

colormode(255)

t.color((55,55,55))
for i in range(200):
t.circle(i,a)
t.right(b)
t.circle(i,a)


#input('Press any key to continue...')

-

===error===
Traceback (most recent call last):
  File "H:\python\snowflake.py", line 9, in 
screen.colormode(255)
NameError: name 'screen' is not defined
===

any help would be appreciated,
thanks

Mark

City of Glasgow College | Scottish Charity Number SCO36198 | VAT Number 
59677128DISCLAIMER :- This email, together with any attachments, may be 
confidential and the subject of legal privilege. If you are not the intended 
recipient, please notify the sender of this email immediately, delete this 
message and note that you are not permitted to print, copy, disclose or use the 
content in any way. City of Glasgow College does not accept any legal 
responsibility of liability (including in negligence) for the contents of this 
communication, nor does it endorse or accept any personal views represented 
herein. Email communications may be subject to interception by third parties or 
possible data corruption and City of Glasgow College accepts no responsibility 
whatsoever for the content of communications altered after transmission from 
the college network.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor