Skip to content

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

@Rhababaer

Description

@Rhababaer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions