hi so for my project we were asked to ask the user to input a width and height for the dimensions of turtle screen.

i asked for a user input then split it, and put in into a list then converted the two separate numbers into integers.

so for example the user input 600 500 i split it to
w = 600
h = 500

when i set the dimensions in the code though, and use the variables like this:
turtle._root.geometry('w x h'),
it gives me an error.

any help on how to do this properly so it would not give me an error??

Recommended Answers

All 3 Replies

Try
turtle._root.geometry('%dx%d' % (w, h))

However:
AttributeError: 'module' object has no attribute '_root'

I think we have the same assignment... I was battling with it also this morning during my tutorials. But to save your time, just use the new python that says turtle.setup(w,h).
If you're in John Aycock's class, check his website for it.

hi so for my project we were asked to ask the user to input a width and height for the dimensions of turtle screen.

i asked for a user input then split it, and put in into a list then converted the two separate numbers into integers.

so for example the user input 600 500 i split it to
w = 600
h = 500

when i set the dimensions in the code though, and use the variables like this:
turtle._root.geometry('w x h'),
it gives me an error.

any help on how to do this properly so it would not give me an error??

Thanks Tops!
Reading the manual does work.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.