James Messinger
James Messinger

Reputation: 3243

Can a Sublime Text plugin resize the window?

I'm brand-new to Python, and I'm trying to write my first plugin for Sublime Text.

I want my plugin to resize the Sublime window, but I can't find any functions to do that in the Sublime Text API. Basically, I'm trying to do something like this:

win = sublime.active_window()
win.setBounds(500, 500)

Am I just missing something in the API? Or perhaps this is something that can be done via standard Python code, without using the Sublime Text API?

Upvotes: 2

Views: 492

Answers (1)

Keith Hall
Keith Hall

Reputation: 16055

You can resize the window with the resize_window command. However, I am not sure if you can re-position it through the API.

window.run_command('resize_window', {'width': 800, 'height': 600})

But, I noticed there is a hwnd method on the window, which could allow you to use Windows APIs to manipulate the window. To do so from Python, probably you should use the PyWin32 module. Note that hwnd returns 0 on Linux, so it seems to not be a cross platform way to retrieve the window handle.

Upvotes: 2

Related Questions