From 9fbb7be7172b190a45ea6976aecc1995904f3bf4 Mon Sep 17 00:00:00 2001 From: Amy Bowersox Date: Wed, 11 Dec 2019 12:12:33 -0700 Subject: [PATCH] I forgot you can't alter the elements of tuples --- scripts/demo1.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/scripts/demo1.py b/scripts/demo1.py index 1c30f00..bd59231 100755 --- a/scripts/demo1.py +++ b/scripts/demo1.py @@ -9,22 +9,15 @@ YELLOW = upiwin.rgb(255, 255, 0) hdc = upiwin.DevCtxt(type='screen') # divide the screen into "drawing" and "command" areas -drawing_rect = hdc.get_clip_rect() -command_rect = drawing_rect -drawing_rect[2] -= 60; -command_rect[0] = drawing_rect[2] + 1 +screen_rect = hdc.get_clip_rect() +drawing_rect = (screen_rect[0], screen_rect[1], screen_rect[2] - 60, screen_rect[3]) +command_rect = (drawing_rect[2], screen_rect[1], screen_rect[2], screen_rect[3]) # further divide up the "command" area -cmd1_rect = command_rect -cmd2_rect = command_rect -cmd3_rect = command_rect -cmd4_rect = command_rect -cmd1_rect[3] = 60; -cmd2_rect[1] = 60; -cmd2_rect[3] = 120; -cmd3_rect[1] = 120; -cmd3_rect[3] = 180; -cmd4_rect[1] = 180; +cmd1_rect = (command_rect[0], command_rect[1], command_rect[2], 60) +cmd2_rect = (command_rect[0], 60, command_rect[2], 120) +cmd3_rect = (command_rect[0], 120, command_rect[2], 180) +cmd3_rect = (command_rect[0], 180, command_rect[2], command_rect[3]) def point_in_rect(rect, x, y): return (x >= rect[0]) and (x < rect[2]) and (y >= rect[1]) and (y < rect[3])