Найти - Пользователи
Полная версия: Помогите пожалуйста не могу найти ошибку!
Начало » Python для новичков » Помогите пожалуйста не могу найти ошибку!
1
matriza_Carl@
from tkinter import *
HEIGHT = 500
WIDTH = 800
window = Tk()
window.title('Bubble Blaster')
c = Canvas(window, width=WIDTH, height=HEIGHT, bg='darkblue')
c.pack

ship_id = c.create_polygon(5, 5, 5, 25, 30, 15, fill='red')
ship_id2 = c.create_oval(0, 0, 30, 30, outline='red')
SHIP_R = 15
MID_X = WIDTH / 2
MID_Y = HEIGHT / 2
c.move(ship_id, MID_X, MID_Y)
c.move(ship_id2, MID_X, MID_Y)
SHIP_SPD = 10

def move_ship(event):
if event.keysym == ‘Up’:
c.move(ship_id, 0, -SHIP_SPD)
c.move(ship_id2, 0, -SHIP_SPD)
elif event.keysym == ‘Down’:
c.move(ship_id, 0, SHIP_SPD)
c.move(ship_id2, 0, SHIP_SPD)
elif event.keysym == ‘Left’:
c.move(ship_id, -SHIP_SPD, 0)
c.move(ship_id2, -SHIP_SPD, 0)
elif event.keysym == ‘Right’:
c.move(ship_id, SHIP_SPD, 0)
c.move(ship_id2, SHIP_SPD, 0)
c.bind_all('<Key>', move_ship)


marvellik
c.pack пишется с скобками c.pack() при копировании вместо кавычек ‘Up’ ‘Down’ в коде получились апостофы ‘Up’ ‘Down’ и т.д.
4kpt_V
Да и где mainloop()…
P.S. Оберните код в теги.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB