Prevent [Ruby/]Tk window resizing

I had some trouble finding how to prevent Tk windows from being resized by users at runtime, so now that I've found out how I'm putting it here and passing it off as a legitimate post. Clever, right? :). Entirely pointless introductory paragraphs aside, simply set the resizable attribute of the TkRoot to (0, 0). Looks like a guy with a crooked nose.

For example, if you're a Rubyist using a beautiful block to create your new TkRoot window:

rootMain = TkRoot.new |main| do
  [..]
  resizable 0, 0
end

Or if you're doing it the more traditional way with hash parameters:

rootMain = tkRoot.new{ 'resizable' => '0, 0', [..] }

And because I used to be a Perl Guy and still use it for some stuff:

$rootMain->resizable(0, 0);

The next thing I need to find out is how to allow only horizontal resizing while vertical resizing is locked, and vica versa. Any ideas?


Imprint

This is one of about 5000 posts on Rubénerd. View the home page for the latest, or related posts also tagged with:

If you liked this post, feel free to buy me a coffee, leave me a comment on Twitter, or email me at weblog2017@rubenschade.com. Thanks :).