jarvisteach / appJar

Simple Tkinter GUIs in Python
http://appJar.info
Other
615 stars 67 forks source link

docs/Lessons/samples/editor.py does not work #645

Open Rhababaer opened 2 years ago

Rhababaer commented 2 years ago

Bug Report


Expected Behaviour


saving and opening text files should work

Actual Behaviour


produces errors for saveBox and openBox respectively

Any error messages produced by appJar


Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.10/tkinter/__init__.py", line 1921, in __call__
    return self.func(*args)
  File "/home/name/.local/lib/python3.10/site-packages/appJar/appjar.py", line 3783, in <lambda>
    return lambda *args: funcName(param)
  File "/home/name/example.py", line 43, in menus
    if win.textAreaChanged("win"): save()
  File "/home/name/example.py", line 19, in save
    file.write(text)
AttributeError: 'str' object has no attribute 'write'
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.10/tkinter/__init__.py", line 1921, in __call__
    return self.func(*args)
  File "/home/name/.local/lib/python3.10/site-packages/appJar/appjar.py", line 3783, in <lambda>
    return lambda *args: funcName(param)
  File "/home/name/example.py", line 38, in menus
    open()
  File "/home/name/example.py", line 9, in open
    contents = file.read()
AttributeError: 'str' object has no attribute 'read'

Fix

add asFile=True parameter to saveBox and openBox