Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 16862

Why is there a little arrow in the middle of the screen?

$
0
0

I hide all turtles that are supposed to be hidden. I am wondering why there is always a little arrow in the middle of the screen (see screen shot below code).

import timefrom turtle import Screenfrom player import Playerfrom car_manager import CarManagerfrom scoreboard import Scoreboardplay = Player()scoreboard = Scoreboard()car_manager = CarManager()screen = Screen()screen.setup(width=600, height=600)screen.tracer(0)screen.listen()screen.onkey(play.turtle_move_up, "Up")game_is_on = Truewhile game_is_on:    time.sleep(0.1)    screen.update()    car_manager.create_car()    car_manager.car_move()    if play.is_at_cross_line():        scoreboard.score_increase()        car_manager.speed_up()        play.move_to_starting_point()    for car in car_manager.car_list:        if car.distance(play) < 20:            scoreboard.game_over()            game_is_on = Falsescreen.exitonclick()# classes from turtle import TurtleFONT = ("Courier", 24, "normal")class Scoreboard(Turtle):    def __init__(self):        super().__init__()        self.hideturtle()        self.penup()        self.level = 1        self.score_update()    def score_update(self):        self.clear()        self.goto(-260, 260)        self.write(f"Level:{self.level}", align="left", font=FONT)    def score_increase(self):        self.level += 1        self.score_update()    def game_over(self):        self.goto(0, 0)        self.write("Game Over", align='center', font=FONT)from turtle import TurtleSTARTING_POSITION = (0, -280)MOVE_DISTANCE = 10FINISH_LINE_Y = 280class Player(Turtle):    def __init__(self):        super().__init__()        self.penup()        self.speed = MOVE_DISTANCE        self.shape("turtle")        self.move_to_starting_point()    def move_to_starting_point(self):        self.goto(0, -280)        self.setheading(90)    def turtle_move_up(self):        self.forward(MOVE_DISTANCE)    def is_at_cross_line(self):        if self.ycor() > 280:            return True        else:            return Falsefrom turtle import Turtleimport randomCOLORS = ["red", "orange", "yellow", "green", "blue", "purple"]STARTING_MOVE_DISTANCE = 5MOVE_INCREMENT = 10class CarManager(Turtle):    def __init__(self):        super().__init__()        self.car_list = []        self.speed = STARTING_MOVE_DISTANCE    def create_car(self):        random_chance = random.randint(1,6)        if random_chance == 1:            new_car = Turtle("square")            new_car.penup()            new_car.shapesize(stretch_wid=1, stretch_len=2)            new_car.color(random.choice(COLORS))            new_car.goto(300, random.randint(-230, 230))            self.car_list.append(new_car)    def car_move(self):        for car in self.car_list:            car.backward(self.speed)    def speed_up(self):        self.speed += MOVE_INCREMENT

Screen shot illustrating the problem

How can I get rid of the annoying >-like arrow in the middle of the screen?


Viewing all articles
Browse latest Browse all 16862


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>