p5 icon indicating copy to clipboard operation
p5 copied to clipboard

Title setting on MacOS

Open thenamangoyal opened this issue 4 years ago • 2 comments

Describe the bug

Unable to set title using title(). Leads to following error

py36/lib/python3.6/site-packages/glfw/__init__.py", line 68, in <lambda>
    _to_char_p = lambda s: s.encode('utf-8')
AttributeError: 'bytes' object has no attribute 'encode'
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> for Event
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> repeat 2
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> repeat 4
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> repeat 8
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> repeat 16
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> repeat 32
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> repeat 64
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> repeat 128
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> repeat 256
ERROR: Invoking <bound method Sketch.on_timer of <Sketch (Glfw) at 0x7fb444bfcda0>> repeat 512

To Reproduce

from p5 import *

def setup():
    title("hellow")
    size(800,600)

def draw():
    pass

run()

System information:

  • p5 release (version number or latest commit): 0.7.1
  • Python version: 3.6
  • Operating system: MacOS

thenamangoyal avatar Nov 13 '21 16:11 thenamangoyal

Thank you for submitting your first issue to p5py

github-actions[bot] avatar Nov 13 '21 16:11 github-actions[bot]

The only workaround seems setting builtins.title before running

Following works

from p5 import *

def setup():
    # title("hellow")
    size(800,600)

def draw():
    pass

builtins.title = "hellow"
run()

thenamangoyal avatar Nov 13 '21 16:11 thenamangoyal