image - importing pictures to python -


i have 2 pictures "gif" , want insert them small pictures , add them python code. want picture stay in accurate location decrease size. when try run code shell shows error "screen isn't defined"

import turtle import time tkinter import *  screen=turtle.turtle() screen=turtle.getscreen() screen.register_shape("health.gif") screen.penup() screen.shape("health.gif") screen.goto(x+50,y+150) 

i don't know why you're getting error... have mixup variable names... create variable call screen turtle.turtle() overwrite variable doing turtle.getscreen()

doing:

import turtle  t=turtle.turtle() screen=t.getscreen() screen.register_shape("health.gif") t.penup() t.shape("health.gif") 

draws health.gif image (if happens in working directory)


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -