Dec-08-2017, 12:45 PM
Dec-08-2017, 01:37 PM
Try with all keys binding to the canvas not root window.
Dec-08-2017, 03:09 PM
Still the same problem
Dec-08-2017, 03:17 PM
Try changes arrows keys wasd.
# moving ship if Game.keys_press.get('a', False): Game.canvas.move(Game.ship, -Game.ship_speed, 0) if Game.keys_press.get('d', False): Game.canvas.move(Game.ship, Game.ship_speed, 0) if Game.keys_press.get('w', False): Game.canvas.move(Game.ship, 0, -Game.ship_speed) if Game.keys_press.get('s', False): Game.canvas.move(Game.ship, 0, Game.ship_speed) if Game.keys_press.get('space', False): if pauser_elaspe(Game.shoot_pauser, Game.ticks): shoot()
Dec-08-2017, 03:22 PM
Now it works correctly
Dec-08-2017, 03:28 PM
Sounds like a keyboard error.
Dec-08-2017, 03:30 PM
Can you tell me about where can I find a good tutorial about tkinter and bindings with detail
Hhhhhh
I don't understand.
Maybe it about the version of python!!!
I use 3.6
Even with 3.5 and 2.7.12
Has the same problem
Hhhhhh
I don't understand.
Maybe it about the version of python!!!
I use 3.6
Even with 3.5 and 2.7.12
Has the same problem
Dec-08-2017, 03:39 PM
i use python 3.6. Arrows keys and wasd keys should work the same. So sound like need test with another keyboard. To see if you get same results.
I use this PDF .
I use this PDF .
Dec-08-2017, 11:17 PM
Here a small key press and release program example
import tkinter as tk class App: pass def event_press(event): if App.texts.get(event.keysym, False) is False: App.texts[event.keysym] = tk.Label(App.frame, text='Key Press ' + event.keysym) App.texts[event.keysym].pack() else: App.texts[event.keysym]['text'] = 'Key Press ' + event.keysym def event_release(event): # numlock if event.keysym.startswith('KP') and event.char != '': key = 'KP_' + event.char else: key = event.keysym if App.texts.get(key, False): App.texts[key]['text'] = 'Key Release ' + key def main(): App.SCREEN_SIZE = {'w':600, 'h':400} App.root = tk.Tk() App.frame = tk.Frame(App.root, width=App.SCREEN_SIZE['w'], height=App.SCREEN_SIZE['h']) App.frame.pack() App.texts = {} App.frame.bind_all('<KeyPress>', event_press) App.frame.bind_all('<KeyRelease>', event_release) App.root.mainloop() if __name__ == '__main__': main()
Dec-09-2017, 01:05 AM
Thank you for the ebook
Iam using laptop "azerty" keyboard, I don't have USB keyboard
Iam using laptop "azerty" keyboard, I don't have USB keyboard