D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] python and geany + turtle

 

On Tue, 3 Apr 2012, paul sutton wrote:

Hi

in python if open a terminal window and load python and then use the code

import turtle
t = turtle.pen()

as per the code mentioned in snake wrangling for kids (kids python book)
adn

it displays a canvas thing that has a pointer which is linked to the
above code,  I can then draw things with python


However if I use the same code in geany which is a text editor for
programming the code a runs without a problem but doesn't display the
canvas,  I
just wondered what is going wrong.

I assume the canvas is some sort of child process that isn't being
called up as a result of using geany,  but not sure.

I am just beginning this so if its normal I can run stuff from the
console otherwise if its simple to fix I can run from geany and display
the canvas then that would be useful,

I've no idea what geany is... But if you want to do turtle graphics, then you can always do it in BASIC ;-)

http://unicorn.drogon.net/turtle1.png

(apologies for the chunky low-res graphics, it can do native screen resolution too!)

http://unicorn.drogon.net/rtb1.png

And of off-the-cuff thought about geany - is there some sort of 'Flip' instruction you can use? If it uses SDL (Which I think it does), then you might need to cause it to do a flip screen event - which it might be doing in interactive mode anyway.... Or it the python program ending before it's had a chance to actually display the canvas?

Gordon

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/listfaq