# Improving the 'title' of a second window in Python Mode

**URL:** <https://discourse.processing.org/t/improving-the-title-of-a-second-window-in-python-mode/13746>\
**Category:** Processing.py\
**Created:** [September 1, 2019, 4:34pm UTC](https://discourse.processing.org/t/improving-the-title-of-a-second-window-in-python-mode/13746 "2019-09-01T16:34:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [September 1, 2019, 4:34pm UTC](https://discourse.processing.org/t/improving-the-title-of-a-second-window-in-python-mode/13746/1 "2019-09-01T16:34:48Z")

</div>

Thanks to GoToLoop and others who discussed it here and on the earlier forums, I know I can make a sketch with more than one window like this:

```auto
def setup():
    size(200, 300)
    second_window = OtherWindow()  
    
def draw():
    background(0)
    ellipse(mouseX, mouseY, 10, 10)

class OtherWindow(PApplet):  
        
    def __init__ (self):
        switches = ('--sketch-path=' + sketchPath(), '')
        PApplet.runSketch(switches, self)  
        
    def settings(self):
        self.size(300, 200)
        
    def draw(self):  
        self.background(255)
        self.fill(0)
        self.rect(self.mouseX, self.mouseY, 10, 10)

```

I would like to set the title of my second window (the defaut is an ugly `"_main_$OtherWindow$"`), but I can’t find the surface.setTitle(" ") method for it.

Any clues?

---

<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:** [September 1, 2019, 4:51pm UTC](https://discourse.processing.org/t/improving-the-title-of-a-second-window-in-python-mode/13746/2 "2019-09-01T16:51:33Z")

</div>

Use `this.surface.setTitle()` and `second_window.surface.setTitle()`. When I modify your sketch, this works:

```auto
def setup():
    size(200, 300)
    this.surface.setTitle("1")
    second_window = OtherWindow()
    second_window.surface.setTitle("2")

```

- [https://github.com/jdf/Processing.py-Bugs/issues/184#issuecomment-440058930](https://github.com/jdf/Processing.py-Bugs/issues/184#issuecomment-440058930)

Or, from inside the object, use `self.surface.setTitle()`:

```auto
    def __init__ (self):
        switches = ('--sketch-path=' + sketchPath(), '')
        PApplet.runSketch(switches, self)
        self.surface.setTitle("3")

```

Weirdly `self.frame.setTitle()` also works only from within the object – perhaps legacy syntax, or something about java.awt…

 ![52%20AM](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/4/41895586b3a7de05dbb59977dd56b14241434035.png)

---

<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:** [September 1, 2019, 5:54pm UTC](https://discourse.processing.org/t/improving-the-title-of-a-second-window-in-python-mode/13746/3 "2019-09-01T17:54:13Z")

</div>

> [@jeremydouglass](#):
>
> Or, from inside the object, use `self.surface.setTitle()` :

Or `self.surface.title = 'Sketch Title'`

---

<div class="post-metadata">

**Author:** ![villares](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/villares/32/3166_2.png) [@villares](https://discourse.processing.org/u/villares)\
**Post date:** [September 2, 2019, 8:07pm UTC](https://discourse.processing.org/t/improving-the-title-of-a-second-window-in-python-mode/13746/4 "2019-09-02T20:07:18Z")

</div>

I guess I’m getting crazy or something!  
I swear I tried `self.surface.setTitle()` before and it didn’t work!  
Thanks!
