@@ -15,7 +15,7 @@ def __init__(
1515 title = "mujoco-python-viewer" ,
1616 width = None ,
1717 height = None ,
18- hide_statistics_menu = False ):
18+ hide_menus = True ):
1919 self .model = model
2020 self .data = data
2121
@@ -42,8 +42,7 @@ def __init__(
4242 self ._run_speed = 1.0
4343 self ._loop_count = 0
4444 self ._advance_by_one_step = False
45- self ._hide_help_menu = True
46- self ._hide_statistics_menu = hide_statistics_menu
45+ self ._hide_menus = hide_menus
4746
4847 # glfw init
4948 glfw .init ()
@@ -92,7 +91,7 @@ def __init__(
9291 def _key_callback (self , window , key , scancode , action , mods ):
9392 if action != glfw .RELEASE :
9493 if key == glfw .KEY_LEFT_ALT :
95- self ._hide_help_menu = False
94+ self ._hide_menus = False
9695 return
9796 # Switch cameras
9897 elif key == glfw .KEY_TAB :
@@ -139,11 +138,9 @@ def _key_callback(self, window, key, scancode, action, mods):
139138 self .vopt .frame = 1 - self .vopt .frame
140139 # Hide overlay menu
141140 elif key == glfw .KEY_LEFT_ALT :
142- self ._hide_help_menu = True
141+ self ._hide_menus = True
143142 elif key == glfw .KEY_H :
144- self ._hide_help_menu = not self ._hide_help_menu
145- elif key == glfw .KEY_A :
146- self ._hide_statistics_menu = not self ._hide_statistics_menu
143+ self ._hide_menus = not self ._hide_menus
147144 # Make transparent
148145 elif key == glfw .KEY_R :
149146 self ._transparent = not self ._transparent
@@ -461,8 +458,7 @@ def add_overlay(gridpos, text1, text2):
461458 topleft ,
462459 "Referenc[e] frames" ,
463460 "On" if self .vopt .frame == 1 else "Off" )
464- add_overlay (topleft , "[H]ide Help Menu (this menu)" , "" )
465- add_overlay (topleft , "Hide St[A]tistics Menu (bottom-left menu)" , "" )
461+ add_overlay (topleft , "[H]ide Menus" , "" )
466462 if self ._image_idx > 0 :
467463 fname = self ._image_path % (self ._image_idx - 1 )
468464 add_overlay (topleft , "Cap[t]ure frame" , "Saved as %s" % fname )
@@ -518,10 +514,9 @@ def update():
518514 mujoco .mjr_render (self .viewport , self .scn , self .ctx )
519515 # overlay items
520516 for gridpos , [t1 , t2 ] in self ._overlay .items ():
521- if gridpos == mujoco .mjtGridPos .mjGRID_TOPLEFT and self ._hide_help_menu :
522- continue
523-
524- if gridpos == mujoco .mjtGridPos .mjGRID_BOTTOMLEFT and self ._hide_statistics_menu :
517+ menu_positions = [mujoco .mjtGridPos .mjGRID_TOPLEFT ,
518+ mujoco .mjtGridPos .mjGRID_BOTTOMLEFT ]
519+ if gridpos in menu_positions and self ._hide_menus :
525520 continue
526521
527522 mujoco .mjr_overlay (
0 commit comments