# Setting size of display window to a percentage of screen size

**URL:** https://discourse.processing.org/t/setting-size-of-display-window-to-a-percentage-of-screen-size/22228
**Category:** Beginners
**Created:** [June 29, 2020, 1:22am UTC](https://discourse.processing.org/t/setting-size-of-display-window-to-a-percentage-of-screen-size/22228 "2020-06-29T01:22:33Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![SomeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/someone/32/8639_2.png) [@SomeOne](https://discourse.processing.org/u/SomeOne)
#### Post date: [June 29, 2020, 5:51am UTC](https://discourse.processing.org/t/setting-size-of-display-window-to-a-percentage-of-screen-size/22228/2 "2020-06-29T05:51:45Z")

</div>

`size()` usage is quite limited: It can be used only once and it requires explicit values, no variables. So you need to think a bit differently. You can use `displayWidth` to test display size and based on that set size like this.

```auto
void settings() {
  if (displayWidth > 2000) {
    size(2000,2000);
  } else if(displayWidth < 1000) {
    size(500,500);
  } else {
    size(1000,1000);
  }
  
}

```

---

_[View the full topic](https://discourse.processing.org/t/setting-size-of-display-window-to-a-percentage-of-screen-size/22228)._
