# Size(); not working for me / Processing 3.5

**URL:** https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688
**Category:** Processing
**Created:** [January 21, 2019, 3:09am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688 "2019-01-21T03:09:39Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![mike\_d](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@mike\_d](https://discourse.processing.org/u/mike_d)
#### Post date: [January 21, 2019, 3:09am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/1 "2019-01-21T03:09:39Z")

</div>

I’m preparing to deliver the Arduino CTC-101 program, which uses Processing to teach programming topics. One of the first modules introduces the size(); function, but it has no effect on my sketch.

The sketch is super-simple: line 1 sets the window size, line 2 draws an ellipse in the centre of the screen. While I do get my ellipse, my window remains 100 x 100 and the ellipse is centred in this 100 x 100 window. Additionally, I’ve tried several of the included example sketches (Array and Array 2D) - they also fail to resize the program window.

Running Processing 3.5 on a MacBook Pro under OSX 10.14.2.

Code:

```auto
size(400, 200);
ellipse(width/2, height/2, width-1, height-1);

```

While no errors are generated, the size() function does not resize the program window and it does not effect the width or height values. There is a message in the Console: “Could not parse -1 for —display”, which may be related.

 ![30%20PM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/9/9a72ab48ca3986bc60cf6bc966d3a0f9161f3b3e.jpeg)

Thanks for your help!

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [January 21, 2019, 3:17am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/2 "2019-01-21T03:17:20Z")

</div>

there is a basic sketch structure,  
example:

thanks to @Maxxxxz

> for Processing 3.4 only  
> ( on my Raspberry Pi not have a 3.5 available )

```auto
int diam=200;

void setup() {
  size(200,200);
  stroke(200,0,0);
  fill(0,200,0);
}

void draw() {
  background(200,200,0);
  ellipse(width/2,height/2,diam,diam);
}

void mousePressed() {
  diam=mouseX;
}

```

---

<div class="post-metadata">

### Author: ![Maxxxxz](https://avatars.discourse-cdn.com/v4/letter/m/a9a28c/32.png) [@Maxxxxz](https://discourse.processing.org/u/Maxxxxz)
#### Post date: [January 21, 2019, 3:39am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/3 "2019-01-21T03:39:11Z")

</div>

Hello, I can confirm this problem is happening for more than just you.  
kll, your code should normally work, but in Processing 3.5 the size() function just does not seem to work. Fresh install as well.  
 ![sizeproblem](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/2/2e51f85ea3cca62691ee96e4f0cc14eecef3503b.png)

EDIT: utilizing settings() allows for proper sketch sizing. This is because in Processing 3.5, size() must now be in settings(). This should fix your problem.

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [January 21, 2019, 4:27am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/4 "2019-01-21T04:27:23Z")

</div>

> **[settings() / Reference](https://processing.org/reference/settings_.html)**
>
> The settings() function is new with Processing 3.0. It's not needed in most sketches. It's only useful when it's absolutely necessary to define the parameters to size() with a variable. …

> **[setup() / Reference](https://processing.org/reference/setup_.html)**
>
> The setup() function is run once, when the program starts. It's used to define initial environment properties such as screen size and to load media such as images and fonts as the program start…

that are

> Updated on January 20, 2019 05:42:15pm EST

but nothing mentioned like that.  
until now the settings() was usable but only NEEDED  
for eclipse? ( as the above reference states )

can not test on Raspberry Pi RASPBIAN linux until available,  
but on win 7 64bit and right

```auto
int diam=200;

// used for eclipse and mandatory at rev 3.5 ???
void settings() {
   size(200,200); 
}

void setup() {
// size(200,200);
  stroke(200,0,0);
  fill(0,200,0);
}

void draw() {
  background(200,200,0);
  ellipse(width/2,height/2,diam,diam);
}

void mousePressed() {
  diam=mouseX;
}

```

or just a bug what might be fixed, as so much documentation and  
millions of user sketches would needed to be changed??

[https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt](https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt)  
does not indicate that that is a wanted change!

* * *

would be nice if there could be a UPDATE STICKY here at the forum  
that 3.5 now available?

also a news info / or a BLOG with the new features / at

> **[Welcome to Processing!](https://processing.org/)**
>
> Processing is a flexible software sketchbook and a language for learning how to code. Since 2001, Processing has promoted software literacy within the visual arts and visual literacy within technology…

could help

* * *

more play with it:

```auto
// https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt

// here it is the update to : Processing 3.5
// starts with what i think is a bug that size() in setup() not work anymore
// only in settings() seems to work
// tested 21.1.2019 win7 64b // processing 3.5

int off=40, xw = 50, mywidth=300, myheight=300;

void settings() {
  size(mywidth,myheight);  
}

//void setup(){}

void draw() {
  background(200,200,0);
  // ____________________________________________ play new features v3.5
  push(); // incl. Matrix && Style
  fill(200,0,0);
  translate(width/2,height/2);
  circle(0,0,xw);
  pop();
  square(width/2+off,height/2+off,xw);
}

```

---

<div class="post-metadata">

### Author: ![JackWitherell](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jackwitherell/32/3361_2.png) [@JackWitherell](https://discourse.processing.org/u/JackWitherell)
#### Post date: [January 21, 2019, 7:15am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/5 "2019-01-21T07:15:33Z")

</div>

[The answer to this comes up relatively easily using google.](https://github.com/processing/processing/issues/5759)

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [January 21, 2019, 7:39am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/6 "2019-01-21T07:39:05Z")

</div>

> [@kll](#):
>
> Would be nice if there could be an UPDATE STICKY here at the forum  
> that 3.5 is now available?

Given PDE v3.5 is buggy, we should warn NOT to grab it instead! 🐛

I generally wait before grabbing a new version. Other times, I even skip a version entirely! 😈

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [January 21, 2019, 7:54am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/7 "2019-01-21T07:54:14Z")

</div>

> **[r/processing - Size() not working](https://www.reddit.com/r/processing/comments/ai5hhi/size_not_working/)**
>
> 3 votes and 4 comments so far on Reddit

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [January 21, 2019, 3:23pm UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/8 "2019-01-21T15:23:59Z")

</div>

and very fast:

> Processing 3.5.1

[https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt](https://raw.githubusercontent.com/processing/processing/master/build/shared/revisions.txt)

test win7 64b worked, but only with the second try,  
see this:

 ![snap_0025](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/f/fd57518ddc654b40507b163207eba41ac3ac17f3.jpeg)

( settings must be erased completely )

---

<div class="post-metadata">

### Author: ![JackWitherell](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jackwitherell/32/3361_2.png) [@JackWitherell](https://discourse.processing.org/u/JackWitherell)
#### Post date: [January 22, 2019, 4:26am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/9 "2019-01-22T04:26:30Z")

</div>

O̶h̶ ̶n̶o̶,̶ ̶s̶o̶ ̶I̶ ̶g̶u̶e̶s̶s̶ ̶t̶h̶i̶n̶g̶s̶ ̶h̶a̶v̶e̶n̶’̶t̶ ̶b̶e̶e̶n̶ ̶f̶i̶x̶e̶d̶ ̶c̶o̶m̶p̶l̶e̶t̶e̶l̶y̶.̶ ̶ ̶S̶e̶t̶t̶i̶n̶g̶s̶ ̶u̶s̶e̶d̶ ̶t̶o̶ ̶b̶e̶ ̶a̶ ̶g̶o̶o̶d̶ ̶p̶l̶a̶c̶e̶ ̶t̶o̶ ̶k̶e̶e̶p̶ ̶i̶n̶i̶t̶i̶a̶l̶i̶z̶a̶t̶i̶o̶n̶s̶ ̶t̶h̶a̶t̶ ̶y̶o̶u̶ ̶w̶a̶n̶t̶e̶d̶ ̶t̶o̶ ̶r̶u̶n̶ ̶b̶e̶f̶o̶r̶e̶ ̶s̶e̶t̶u̶p̶ ̶o̶r̶ ̶t̶o̶ ̶s̶t̶a̶r̶t̶ ̶a̶s̶y̶n̶c̶h̶r̶o̶n̶o̶u̶s̶ ̶p̶r̶o̶c̶e̶s̶s̶e̶s̶ ̶e̶a̶r̶l̶y̶.̶ ̶n̶o̶w̶ ̶i̶t̶ ̶c̶a̶n̶’̶t̶ ̶b̶e̶ ̶u̶s̶e̶d̶ ̶a̶t̶ ̶a̶l̶l̶ ̶u̶n̶l̶e̶s̶s̶ ̶i̶f̶ ̶i̶t̶’̶s̶ ̶u̶s̶e̶d̶ ̶t̶o̶ ̶a̶s̶s̶i̶g̶n̶ ̶a̶ ̶v̶a̶r̶i̶a̶b̶l̶e̶ ̶b̶a̶s̶e̶d̶ ̶s̶i̶z̶e̶.̶ ̶ ̶k̶l̶l̶ ̶l̶e̶t̶ ̶m̶e̶ ̶k̶n̶o̶w̶ ̶i̶f̶ ̶y̶o̶u̶ ̶a̶r̶e̶n̶’̶t̶ ̶g̶o̶n̶n̶a̶ ̶a̶d̶d̶ ̶t̶h̶i̶s̶ ̶t̶o̶ ̶p̶r̶o̶c̶e̶s̶s̶i̶n̶g̶’̶s̶ ̶i̶s̶s̶u̶e̶ ̶t̶r̶a̶c̶k̶e̶r̶ ̶o̶n̶ ̶g̶i̶t̶h̶u̶b̶,̶ ̶s̶o̶m̶e̶o̶n̶e̶ ̶s̶h̶o̶u̶l̶d̶ ̶p̶r̶o̶b̶a̶b̶l̶y̶ ̶r̶e̶p̶o̶r̶t̶ ̶i̶t̶ ̶s̶o̶o̶n̶.̶

> [@kll](#):
>
> ( settings must be erased completely )

Edit: I just looked into it and this is actually expected behavior  
Processing 3.4 didn’t let you set size with setup when settings existed.  
[The reference](https://processing.org/reference/settings_.html) states that settings is only used for the purpose of handling size early/dynamically and nothing more.

The error could be made better by telling you to delete the settings function but as far as it goes beginners won’t use the settings function unless forced to.

---

<div class="post-metadata">

### Author: ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)
#### Post date: [January 27, 2019, 2:14am UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/10 "2019-01-27T02:14:25Z")

</div>

Justs to summarize:

1. If your sketch has no `setup()` and `draw()` ( **immediate mode** )
  - you can call `size()` in 3.4 or in 3.51. In 3.5 this does not work due to a (fixed) bug:

> <https://github.com/processing/processing/issues/5759>

1. If your sketch has `setup()` and `draw()`, put `size()` in setup.
  - …and if your sketch also has `settings()`, move `size()` to settings. This has been true throughout 3.x, and is explained in the reference. [https://processing.org/reference/settings\_.html](https://processing.org/reference/settings_.html)

---

<div class="post-metadata">

### Author: ![mike\_d](https://avatars.discourse-cdn.com/v4/letter/m/22d042/32.png) [@mike\_d](https://discourse.processing.org/u/mike_d)
#### Post date: [January 30, 2019, 7:19pm UTC](https://discourse.processing.org/t/size-not-working-for-me-processing-3-5/7688/11 "2019-01-30T19:19:45Z")

</div>

Thanks! 3.5.2 seems to have corrected the problem and I appreciate the additional info.
