Trying to solve the window resolution pulldown menu

Godot Version

4.7.1

Question

I am new to Godot (a couple of days in) and I have been setting up a pull down menu to change the window resolution. It works to a point, but I have a couple of problems.

  1. The pull down menu items do not adopt the font or font size of the parent control. The inspector does not seem to provide a way to override the theme for an item, so I understand it has a to be done using a theme (a future learning opportunity, I think). However, I have been able to change the font size when I load the items programmatically, but I cant figure out how to change the actual font itself.

  2. When I select an option from the pull down and resize the window, the window does indeed resize but not the contents. When I move the window, however slightly, then everything resizes correctly. If I resize from the program settings, all the contents resize as expected. Do I ned to refresh the contents in some way after resizing? In the tutorial I watched it ‘just worked’

Id be grateful for help on this.

thanks

I have a partial solution. By adding the window_set_position then contents of the window are now redrawn. However, the two DisplayServer commands do not fully work. If I change the order the second will work but the first will not. SO in this case, the window will resize but not moved to a new position.

Any suggestions?

func _on_item_selected(index: int) -> void:
	var screen_size = DisplayServer.screen_get_size()
	var window_size = RESOLUTIONS.values()[index]
	var left = (screen_size.x/2) - (window_size.x/2)
	var top = (screen_size.y/2) - (window_size.y/2)

	DisplayServer.window_set_position(Vector2(left,top))
	DisplayServer.window_set_size(RESOLUTIONS.values()[index])

NOTE: just noticed it works on the Mac but not on Linux.