88from pynput .keyboard import Controller as KeyboardController , Key , Listener as KeyboardListener
99from pynput .mouse import Controller as MouseController , Button , Listener as MouseListener
1010
11-
1211# Detect platform
1312PLATFORM = platform .system ().lower () # 'darwin' (macOS), 'linux', 'windows', 'android'
1413print (f"Running on: { PLATFORM } " )
@@ -820,14 +819,22 @@ def __init__(self):
820819 self .root .configure (bg = 'black' )
821820 self .root .geometry ("400x600" )
822821
822+ # Force Tk to use older rendering on macOS for color support
823+ # This is a workaround for Tcl/Tk 9.0 aqua theme not respecting colors
824+ try :
825+ # Try to set the window to use the classic appearance
826+ self .root .tk .call ('tk::unsupported::MacWindowStyle' , 'style' , self .root , 'document' , 'closeBox resizable' )
827+ except :
828+ pass
829+
823830 # Macro button configurations: (title, function, state_var_name, is_boolean)
824831 # is_boolean=True means the macro toggles on/off, False means one-shot execution
825832 self .macros = [
826833 ("Arena Automation Type 1" , lambda : self .trigger_macro (start_arena_automation , 1 ), 'size_automation' , True ),
827834 ("Arena Automation Type 2" , lambda : self .trigger_macro (start_arena_automation , 2 ), 'size_automation' , True ),
828835 ("Arena Automation Type 3" , lambda : self .trigger_macro (start_arena_automation , 3 ), 'size_automation' , True ),
829836 ("Conqueror" , lambda : self .trigger_macro (conq_quickstart ), None , False ),
830- ("Brain Damage" , lambda : self .trigger_boolean_macro ('braindamage' ), 'braindamage' , True ),
837+ ("Brain Damage" , lambda : self .toggle_boolean_macro ('braindamage' ), 'braindamage' , True ),
831838 ("Circle" , lambda : self .trigger_macro (circle ), None , False ),
832839 ("Tail (Legacy)" , lambda : self .trigger_macro (start_circle_tail_legacy ), None , False ),
833840 ("Circle Crash" , lambda : self .trigger_macro (circlecrash ), None , False ),
@@ -839,10 +846,10 @@ def __init__(self):
839846 ("200 Circles" , lambda : self .trigger_macro (circles ), None , False ),
840847 ("200 Walls" , lambda : self .trigger_macro (walls ), None , False ),
841848 ("Slow Wall" , lambda : self .trigger_macro (slowwall ), None , False ),
842- ("Art (Shift)" , lambda : self .trigger_boolean_macro ('slowcircle_shift_bind' ), 'slowcircle_shift_bind' , True ),
849+ ("Art (Shift)" , lambda : self .toggle_boolean_macro ('slowcircle_shift_bind' ), 'slowcircle_shift_bind' , True ),
843850 ("Benchmark" , lambda : self .trigger_macro (benchmark ), None , False ),
844851 ("Mini Circle Crash" , lambda : self .trigger_macro (minicirclecrash ), None , False ),
845- ("Engi Spam" , lambda : self .trigger_boolean_macro ('engispamming' ), 'engispamming' , True ),
852+ ("Engi Spam" , lambda : self .toggle_boolean_macro ('engispamming' ), 'engispamming' , True ),
846853 ("50M Score" , lambda : self .trigger_macro (score50m ), None , False ),
847854 ("Controlled Nuke" , lambda : self .trigger_macro (start_controllednuke ), None , False ),
848855 ]
@@ -861,29 +868,35 @@ def __init__(self):
861868 canvas .configure (yscrollcommand = scrollbar .set )
862869
863870 # Toggle all macros button at top
864- self .toggle_all_btn = tk .Button (
871+ self .toggle_all_btn = tk .Label (
865872 scrollable_frame ,
866873 text = "DISABLE ALL MACROS" ,
867- command = self .toggle_all_macros ,
868874 bg = 'green' ,
869875 fg = 'white' ,
870876 font = ('Arial' , 12 , 'bold' ),
871- height = 2
877+ height = 2 ,
878+ relief = 'raised' ,
879+ bd = 2 ,
880+ cursor = 'hand2'
872881 )
882+ self .toggle_all_btn .bind ('<Button-1>' , lambda e : self .toggle_all_macros ())
873883 self .toggle_all_btn .pack (fill = 'x' , padx = 10 , pady = 5 )
874884
875- # Create buttons
885+ # Create buttons (using Labels for color support on macOS)
876886 self .buttons = []
877887 for title , func , state_var , is_boolean in self .macros :
878- btn = tk .Button (
888+ btn = tk .Label (
879889 scrollable_frame ,
880890 text = title ,
881- command = func ,
882891 bg = 'green' ,
883892 fg = 'white' ,
884893 font = ('Arial' , 10 ),
885- height = 2
894+ height = 2 ,
895+ relief = 'raised' ,
896+ bd = 2 ,
897+ cursor = 'hand2'
886898 )
899+ btn .bind ('<Button-1>' , lambda e , f = func : f ())
887900 btn .pack (fill = 'x' , padx = 10 , pady = 2 )
888901 self .buttons .append ((btn , state_var , is_boolean ))
889902
@@ -1019,20 +1032,23 @@ def run(self):
10191032 """Run the GUI main loop"""
10201033 self .root .mainloop ()
10211034
1022- # Start GUI in separate thread
1023- def start_gui ():
1024- gui = MacroGUI ()
1025- gui .run ()
1026-
1027- gui_thread = threading .Thread (target = start_gui )
1028- gui_thread .daemon = True
1029- gui_thread .start ()
1030-
1031- # Start mouse listener glocircley (after your keyboard listener setup)
1032- mouse_listener = MouseListener (on_click = on_click )
1033- mouse_listener .daemon = True
1034- mouse_listener .start ()
1035+ # Start keyboard and mouse listeners in background
1036+ def start_listeners ():
1037+ """Start keyboard and mouse listeners in a thread"""
1038+ # Start mouse listener
1039+ mouse_listener = MouseListener (on_click = on_click )
1040+ mouse_listener .daemon = True
1041+ mouse_listener .start ()
1042+
1043+ # Start keyboard listener (this blocks)
1044+ with keyboard .Listener (on_press = on_press , on_release = on_release ) as listener :
1045+ listener .join ()
10351046
1036- with keyboard .Listener (on_press = on_press , on_release = on_release ) as listener :
1037- listener .join ()
1047+ # Start listeners in separate thread so GUI can run on main thread
1048+ listener_thread = threading .Thread (target = start_listeners )
1049+ listener_thread .daemon = True
1050+ listener_thread .start ()
10381051
1052+ # Run GUI on main thread (required for macOS)
1053+ gui = MacroGUI ()
1054+ gui .run ()
0 commit comments