I seem to understand a little about what python is cursing, but I'm still puzzling.
RuntimeWarning: coroutine 'move_ka' was never awaited self.tk.mainloop (n)
the code itself is small, I confess (I have never worked with this library) Why did I need it?
Because when I press two keys, nothing happens, since it works only if I press one key (you can see from the code right away)
from tkinter import Tk, Canvas, PhotoImage from aiogram import * root= Tk () root.geometry ('700x500') root.resizable (False, False) canvas= Canvas (root, width= 300, height= 400) canvas.pack () my_obj= PhotoImage (file= my picture is here) id_img= canvas.create_image (50,50, anchor= 'c', image= my_obj) # Create an image async def move_ka (event): if event.keysym== 'Left': canvas.move (id_img, -4, 0) async def move_ka2 (event): if event.keysym== 'Right': canvas.move (id_img, 4, 0) canvas.bind_all ('< KeyPress-Left > ', move_ka) # When pressed, call the function canvas.bind_all ('< KeyPress-Right > ', move_ka2) root.mainloop ()
I'll tell you right away that I think this is due to root.mainloop () Tell me please, BUT other links please do not throw, I googled for over an hour!
- python : How to create a large text input field?
- python : How to keep the scale of buttons, text, etc in tkinter?
- python : how to find out the size of a Tkinter window?
- python : Opening photo for background doesn't work
- Python Tkinter not seeing 'TimePL' instance of Label widget
- python : How to create a window in the game for example (dota2)
- python : Error with matrix multiplication. Numpy
- Can't uninstall/install Python
- python : Why does list.remove() incorrectly remove elements in a loop?
- Loading bar in Python 3.x