From 4d0a08597ac0c56932de2629309288df466ea2be Mon Sep 17 00:00:00 2001 From: iabhinavjoshi <31091984+iabhinavjoshi@users.noreply.github.com> Date: Sun, 25 Feb 2018 12:12:10 +0530 Subject: [PATCH] This fixes #71 Added the functionality of creating and closing the game window for proper execution of inputs from the keyboard. --- test/rc_control_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/rc_control_test.py b/test/rc_control_test.py index cec69ca8..154479e7 100644 --- a/test/rc_control_test.py +++ b/test/rc_control_test.py @@ -9,6 +9,7 @@ class RCTest(object): def __init__(self): pygame.init() + screen = pygame.display.set_mode((300, 200)) ## display initialization for pygame window self.ser = serial.Serial('/dev/tty.usbmodem1421', 115200, timeout=1) self.send_inst = True self.steer() @@ -64,6 +65,10 @@ def steer(self): elif event.type == pygame.KEYUP: self.ser.write(chr(0)) + + elif event.type == pygame.QUIT: ## quit functionality for the pygame display window + pygame.display.quit() + pygame.quit() if __name__ == '__main__': RCTest()