How to the my Window to fit the size of its content?

Godot Version

4.6.2

Question

I’m writing a plugin for Godot. I’d like to create a popup window that appears in response to the user pressing a button. It’s mostly working, but I’m having an issue that when my window does appear, it’s too small and you have to manually drag it bigger to be able to see the content in it.

Is there any way to have the window resize itself to fit the minimum size of the content?

What pops up:

var control:UvTriplanarLayoutPanel = preload("res://addons/cyclops_level_builder/gui/docks/uv_editor/actions/uv_triplanar_layout_panel.tscn").instantiate()

var window:Window

func show_window(plugin):
	if !window:
		window = Window.new()
		window.title = "Uv Triplanar Layout"
		
		var panel:PanelContainer = PanelContainer.new()
		window.add_child(panel)
		panel.add_child(control)
		
		window.close_requested.connect(on_close_requested)
	
		var base_control:Node = plugin.get_editor_interface().get_base_control()
		base_control.add_child(window)
	
	control.plugin = plugin
	window.popup_centered()

You can use Window.min_size to manually set it to a size that displays everything.

Not quite what you are asking, but it is a simple solution to your issue.