Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
1

It is not working

I coded this below, and when i click on the canvas, it is not working. Is there an extra command I need to add?

2 years ago
You are viewing a single comment. View All
1
DEMONul1234
DEMONul1234

@DEMONul1234
Of course it is my code, but you can change stuff here and there to match your code. e.g. palate_a is a created square inside of my programme. Just to give you a hint as to what my whole code looks like, here's it:

import turtle, os

win = turtle.Screen()
win.setup(800,600)
win.bgcolor('brown')
win.addshape(os.path.expanduser("C:/Games/c3.gif"))
win.title('My first game')
win.tracer(0)
win.bgpic("C:/Games/space.gif")

palate_a = turtle.Turtle()
palate_a.color('purple')
palate_a.shape(os.path.expanduser("C:/Games/c3.gif"))
palate_a.shapesize(stretch_len= 5, stretch_wid= 10)
palate_a.setposition(0,0)
palate_a.speed(10)
palate_a.penup()
lista = [palate_a]

speed = 10
def up():
palate_a.setheading(90)
palate_a.forward(speed)
def down():
palate_a.setheading(270)
palate_a.forward(speed)
def left():
palate_a.setheading(180)
palate_a.forward(speed)
def right():
palate_a.setheading(0)
palate_a.forward(speed)

class Action_Change_Backgroun:
def init(self, mouse_clic):
self.mouse_clic = mouse_clic
xb = print('good')
Action_mouse = Action_Change_Backgroun(win.onscreenclick(xb,1))
Action_Primary = Action_mouse.mouse_clic

#win.onscreenclick(init(self,clickaction))
win.onkey(up, 'w')
win.onkey(down,'s')
win.onkey(right, 'd')
win.onkey(left, 'a')
win._onscreenclick(Action_Primary, 3)

win.listen()

while True:
win.update()

win.mainloop()

2 years ago