mujoco icon indicating copy to clipboard operation
mujoco copied to clipboard

Programmatically change GUI size in mujoco_viewer / mujoco_viewer_passive

Open pab47 opened this issue 1 year ago • 4 comments

The feature, motivation and pitch

The GUI that opens up when launching the viewer is set at about 960 x 540 (approx). I can manually resize it once it opens up. But this is getting tedious as I have to keep doing it every single time.

Is it possible to set this up programmatically?

In the past, I could do with something like this: window = glfw.create_window(800, 600, "Demo", None, None), but it does not look like glfw's handle is exposed in the viewer.py which makes it impossible to use the functions, set_window_size and get_window_size.

Alternatives

  1. resizing the window manually (works but tedious)
  2. Tried adding glfw.create_window in viewer.py (does not work)

Additional context

No response

pab47 avatar Jan 08 '25 16:01 pab47

Good suggestion. Do you want to try doing doing this yourself and sending a PR?

yuvaltassa avatar Jan 10 '25 11:01 yuvaltassa

Thanks for your response, Yuval. Hmmm. I don't know how to do this. Can you give me some directions so I can try? I am not clear how to expose glfw handle or object. There isn't any handle/object for glfw in viewer.py. Which file do I start looking into?

pab47 avatar Jan 10 '25 11:01 pab47

steps:

  1. build from source
  2. find out where the hard-coding occurs
  3. expose what you want to expose.

the place to look is not in the py file but in simulate.cc

yuvaltassa avatar Jan 10 '25 11:01 yuvaltassa

+1 on this feature. I'm opening multiple windows. Its hard to co-ordinate them without this feature

vikashplus avatar Feb 03 '25 15:02 vikashplus