From dc799034fa3dfcb9365680aa421de2008d6a6048 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Mon, 6 Jun 2022 10:48:37 -0400 Subject: [PATCH 1/3] Updated Cursor Constant List to be a sorted list --- PySimpleGUI.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/PySimpleGUI.py b/PySimpleGUI.py index 9f052bd3..ecea9a4a 100644 --- a/PySimpleGUI.py +++ b/PySimpleGUI.py @@ -889,6 +889,8 @@ TKINTER_CURSORS = ['X_cursor', 'arrow', 'based_arrow_down', 'based_arrow_up', 'b 'top_left_arrow', 'top_left_corner', 'top_right_corner', 'top_side', 'top_tee', 'trek', 'ul_angle', 'umbrella', 'ur_angle', 'watch', 'xterm'] + +TKINTER_CURSORS = ['X_cursor', 'arrow', 'based_arrow_down', 'based_arrow_up', 'boat', 'bogosity', 'bottom_left_corner', 'bottom_right_corner', 'bottom_side', 'bottom_tee', 'box_spiral', 'center_ptr', 'circle', 'clock', 'coffee_mug', 'cross', 'cross_reverse', 'crosshair', 'diamond_cross', 'dot', 'dotbox', 'double_arrow', 'draft_large', 'draft_small', 'draped_box', 'exchange', 'fleur', 'gobbler', 'gumby', 'hand1', 'hand2', 'heart', 'ibeam', 'icon', 'iron_cross', 'left_ptr', 'left_side', 'left_tee', 'leftbutton', 'll_angle', 'lr_angle', 'man', 'middlebutton', 'mouse', 'no', 'none', 'pencil', 'pirate', 'plus', 'question_arrow', 'right_ptr', 'right_side', 'right_tee', 'rightbutton', 'rtl_logo', 'sailboat', 'sb_down_arrow', 'sb_h_double_arrow', 'sb_left_arrow', 'sb_right_arrow', 'sb_up_arrow', 'sb_v_double_arrow', 'shuttle', 'size', 'size_ne_sw', 'size_ns', 'size_nw_se', 'size_we', 'sizing', 'spider', 'spraycan', 'star', 'starting', 'target', 'tcross', 'top_left_arrow', 'top_left_corner', 'top_right_corner', 'top_side', 'top_tee', 'trek', 'ul_angle', 'umbrella', 'uparrow', 'ur_angle', 'wait', 'watch', 'xterm'] # ------------------------- tkinter key codes for bindings ------------------------- # # The keycode that when pressed will take a snapshot of the current window @@ -25101,4 +25103,4 @@ if __name__ == '__main__': exit(0) main() exit(0) -def get_signature(): return b'\x80\xa7E\xfe\xb0l\xb4/\xea\x8c\xab\xcf\x18\x87\xe8B&(9C\xd7\xa2\x8d\xe4\x80\xde\xbd\x01\xbc\x08\x81\x14\xd7\x00\xf0\x9a\xe5\x02b:m8\xec\xdf\xce\x16\xad\x00+8\xcc\xa3\xe1\x11\xef\xf7\xa9\xfe\x06\xd0`\x8b\xf5\xfc\xe6\xbb\xcc~A\xb6^f\xb6P>\x97g\xf2\xa8\x8b\xf7,2\xd7!\xf5\xf7X%yx\xc5W\xe9\x96\x0elh\x9c\xab\x9c\xc7u\x94\xe8?\r\xdc )\xc01=\x1aS\xfe\n\xe9w\x9e\x1f\xfe\xb9_V\x86\x94 ' \ No newline at end of file +def get_signature(): return b"\x87\x0b\x1fd\xfe\x9bd\xef#\xc0\xad\x00Z2\x0f\xe4\xe2\xeaO>\xbd\x9c\x92\xf9\xc5G\xc1'\xfe\xd3\x1a\x06\xc5\x18~>M\xc5P\x0e\x8f6O\xf4f\xad}\x8d\xb3\xfb6\xc5;\xa3\xbc\x99\x1eO\x08{>lj\x96" \ No newline at end of file From f837e05dc6cdc616947dc8983bfddbd9ce7a4be7 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Mon, 6 Jun 2022 10:48:57 -0400 Subject: [PATCH 2/3] Updated Demo to use the new cursor constant --- DemoPrograms/Demo_Cursors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DemoPrograms/Demo_Cursors.py b/DemoPrograms/Demo_Cursors.py index e050022e..b1ffd018 100644 --- a/DemoPrograms/Demo_Cursors.py +++ b/DemoPrograms/Demo_Cursors.py @@ -9,11 +9,11 @@ import webbrowser If you want no cursor, set the cursor to the string 'none'. - Copyright 2021 PySimpleGUI + Copyright 2021, 2022 PySimpleGUI """ # Here is a more complete list of cursors you can choose from -cursors = ('X_cursor', 'no', 'arrow','based_arrow_down','based_arrow_up','boat','bogosity','bottom_left_corner','bottom_right_corner','bottom_side','bottom_tee','box_spiral','center_ptr','circle','clock','coffee_mug','cross','cross_reverse','crosshair','diamond_cross','dot','dotbox','double_arrow','draft_large','draft_small','draped_box','exchange','fleur','gobbler','gumby','hand1','hand2','heart','icon','iron_cross','left_ptr','left_side','left_tee','leftbutton','ll_angle','lr_angle','man','middlebutton','mouse','no','pencil','pirate','plus','question_arrow','right_ptr','right_side','right_tee','rightbutton','rtl_logo','sailboat','sb_down_arrow','sb_h_double_arrow','sb_left_arrow','sb_right_arrow','sb_up_arrow','sb_v_double_arrow','shuttle','sizing','spider','spraycan','star','target','tcross','top_left_arrow','top_left_corner','top_right_corner','top_side','top_tee','trek','ul_angle','umbrella','ur_angle','watch','xterm','arrow','center_ptr','crosshair','fleur','ibeam','icon','sb_h_double_arrow','sb_v_double_arrow','watch','xterm','no','starting','size','size_ne_sw','size_ns','size_nw_se','size_we','uparrow','wait','arrow','cross','crosshair','ibeam','plus','watch','xterm') +cursors = sg.TKINTER_CURSORS sg.theme('Light Blue 2') From 5dd1e48f04e013e20cd58db8d68a5392147ca597 Mon Sep 17 00:00:00 2001 From: PySimpleGUI Date: Mon, 6 Jun 2022 10:49:13 -0400 Subject: [PATCH 3/3] New Demo Program - cursor previewer --- DemoPrograms/Demo_Cursor_Previewer.py | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 DemoPrograms/Demo_Cursor_Previewer.py diff --git a/DemoPrograms/Demo_Cursor_Previewer.py b/DemoPrograms/Demo_Cursor_Previewer.py new file mode 100644 index 00000000..70bcb33d --- /dev/null +++ b/DemoPrograms/Demo_Cursor_Previewer.py @@ -0,0 +1,48 @@ +import PySimpleGUI as sg + +""" + Demo - Preview tkinter cursors + + Shows the standard tkinter cursors using Buttons + + The name of the cursor is on the Button. Mouse over the Button and you'll see + what that cursor looks like. + This list of cursors is a constant defined in PySimpleGUI. The constant name is: + sg.TKINTER_CURSORS + + Copyright 2022 PySimpleGUI + +""" + +cursors = sg.TKINTER_CURSORS +# Make a layout that's 10 buttons across +NUM_BUTTONS_PER_ROW = 10 +layout = [[]] +row = [] +for i, c in enumerate(cursors): + # print(i, c) + row.append(sg.Button(c, size=(14,3), k=c)) + if ((i+1) % NUM_BUTTONS_PER_ROW) == 0: + layout.append(row) + row = [] + # print(row) +# Add on the last, partial row +start = len(cursors)//NUM_BUTTONS_PER_ROW * NUM_BUTTONS_PER_ROW +row = [] +for i in range(start, len(cursors)): + row.append(sg.Button(cursors[i], size=(14,3), k=cursors[i])) +layout.append(row) + +window = sg.Window('Cursor Previewer',layout, finalize=True) + +# set the cursor on each of the buttons that has the name of the cursor as the text +for c in cursors: + window[c].set_cursor(c) + +# The ubiquitous event loop... +while True: + event, values = window.read() + if event == sg.WIN_CLOSED: + break + +window.close() \ No newline at end of file