# How does one fix the aspect ratio while resizing a window in glfw?

**URL:** <https://discourse.glfw.org/t/how-does-one-fix-the-aspect-ratio-while-resizing-a-window-in-glfw/1578>\
**Category:** support\
**Created:** [June 1, 2020, 1:29pm UTC](https://discourse.glfw.org/t/how-does-one-fix-the-aspect-ratio-while-resizing-a-window-in-glfw/1578 "2020-06-01T13:29:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prithvidiamond1](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/prithvidiamond1/32/347_2.png) [@prithvidiamond1](https://discourse.glfw.org/u/prithvidiamond1)\
**Post date:** [June 1, 2020, 1:29pm UTC](https://discourse.glfw.org/t/how-does-one-fix-the-aspect-ratio-while-resizing-a-window-in-glfw/1578/1 "2020-06-01T13:29:13Z")

</div>

How do I maintain the aspect ratio set on creation when resizing my window in glfw? I tried searching for a guide/tutorial but I couldn’t find any answers as to how… I know it will be something inside a function passed to the `glfw.set_window_size_callback` function but what would that be?

---

<div class="post-metadata">

**Author:** ![dougbinks](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/dougbinks/32/39_2.png) [@dougbinks](https://discourse.glfw.org/u/dougbinks)\
**Post date:** [June 1, 2020, 2:08pm UTC](https://discourse.glfw.org/t/how-does-one-fix-the-aspect-ratio-while-resizing-a-window-in-glfw/1578/2 "2020-06-01T14:08:34Z")

</div>

See the Window Size limit section of the documentation:  
[https://www.glfw.org/docs/3.3/window\_guide.html#window\_sizelimits](https://www.glfw.org/docs/3.3/window_guide.html#window_sizelimits)

Specifically [glfwSetWindowAspectRatio](https://www.glfw.org/docs/3.3/group__window.html#ga72ac8cb1ee2e312a878b55153d81b937).

---

<div class="post-metadata">

**Author:** ![prithvidiamond1](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.glfw.org/prithvidiamond1/32/347_2.png) [@prithvidiamond1](https://discourse.glfw.org/u/prithvidiamond1)\
**Post date:** [June 1, 2020, 2:54pm UTC](https://discourse.glfw.org/t/how-does-one-fix-the-aspect-ratio-while-resizing-a-window-in-glfw/1578/3 "2020-06-01T14:54:13Z")

</div>

It works! Thanks so much!
