# \[HELP\]\[ Python vs Java \] size(width,height)

**URL:** <https://discourse.processing.org/t/help-python-vs-java-size-width-height/7320>\
**Category:** Processing.py\
**Created:** [January 8, 2019, 1:36pm UTC](https://discourse.processing.org/t/help-python-vs-java-size-width-height/7320 "2019-01-08T13:36:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sky](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sky/32/3013_2.png) [@Sky](https://discourse.processing.org/u/Sky)\
**Post date:** [January 8, 2019, 1:36pm UTC](https://discourse.processing.org/t/help-python-vs-java-size-width-height/7320/1 "2019-01-08T13:36:56Z")

</div>

☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕

Why am I able to do this in Python

```auto
width = 700
height = 500

def setup():
    size (width,height)
    
def draw():
    rect(100,100,100,100)

```

but not in Java?

```auto
int width = 700;
int height = 500;

void setup(){
size (width,height); // cant do
}

void draw(){
 rect(100,100,100,100);
}

```

☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕🐍☕

---

<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 8, 2019, 2:18pm UTC](https://discourse.processing.org/t/help-python-vs-java-size-width-height/7320/2 "2019-01-08T14:18:10Z")

</div>

IMO, Processing’s devs could easily make the pre-processor to move `size(w, h);` from **setup()** to **settings()** together w/ the dimension arguments when they’re variables. 🧐

The pre-processor can move the 3rd renderer variable argument already: 😳

```auto
static final String RENDER = FX2D;

void setup() {
  size(800, 600, RENDER);
  noLoop();
}

```

So what’s the excuse for not moving the 1st & 2nd variable arguments as well!? 🤪

---

<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 8, 2019, 3:35pm UTC](https://discourse.processing.org/t/help-python-vs-java-size-width-height/7320/3 "2019-01-08T15:35:36Z")

</div>

BUT  
you can do like @GoToLoop mentioned

```auto
int mywidth=800, myheight=600;

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

void setup() {
  println("canvas: "+width+" * "+height);
}

void draw() {
  background(200,200,0);
}

```
