goshawk111 / FishboneDiagramGenerator

1 stars 0 forks source link

save file doest work #1

Open tungs0ul opened 3 years ago

tungs0ul commented 3 years ago

whenever I try to save as png or anything it does not work. Here is the error code File "/usr/lib/python3.8/runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "/usr/lib/python3.8/runpy.py", line 87, in _run_code exec(code, run_globals) File "/home/bondiq/Schreibtisch/FishboneDiagramGenerator/fishbone_diagram_generator/__main__.py", line 7, in <module> MainApp().run() File "/home/bondiq/.local/lib/python3.8/site-packages/kivy/app.py", line 950, in run runTouchApp() File "/home/bondiq/.local/lib/python3.8/site-packages/kivy/base.py", line 582, in runTouchApp EventLoop.mainloop() File "/home/bondiq/.local/lib/python3.8/site-packages/kivy/base.py", line 347, in mainloop self.idle() File "/home/bondiq/.local/lib/python3.8/site-packages/kivy/base.py", line 391, in idle self.dispatch_input() File "/home/bondiq/.local/lib/python3.8/site-packages/kivy/base.py", line 342, in dispatch_input post_dispatch_input(*pop(0)) File "/home/bondiq/.local/lib/python3.8/site-packages/kivy/base.py", line 308, in post_dispatch_input wid.dispatch('on_touch_up', me) File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch File "/home/bondiq/.local/lib/python3.8/site-packages/kivy/uix/behaviors/button.py", line 179, in on_touch_up self.dispatch('on_release') File "kivy/_event.pyx", line 705, in kivy._event.EventDispatcher.dispatch File "kivy/_event.pyx", line 1248, in kivy._event.EventObservers.dispatch File "kivy/_event.pyx", line 1132, in kivy._event.EventObservers._dispatch File "/home/bondiq/.local/lib/python3.8/site-packages/kivy/lang/builder.py", line 57, in custom_callback exec(__kvlang__.co_value, idmap) File "/home/bondiq/Schreibtisch/FishboneDiagramGenerator/fishbone_diagram_generator/fishbone_diagram_generator.kv", line 61, in <module> on_release: root.save(filechooser.path, text_input.text) File "/home/bondiq/Schreibtisch/FishboneDiagramGenerator/fishbone_diagram_generator/main_app.py", line 113, in save_png png_saver.save() File "/home/bondiq/Schreibtisch/FishboneDiagramGenerator/fishbone_diagram_generator/png_saver.py", line 110, in save self.add_text_area(self.fishbone.text, self.fishbone.main_bone[1].x + 50, File "/home/bondiq/Schreibtisch/FishboneDiagramGenerator/fishbone_diagram_generator/png_saver.py", line 220, in add_text_area fontPIL = ImageFont.truetype(font='Roboto-Regular.ttf', size=size) File "/usr/lib/python3/dist-packages/PIL/ImageFont.py", line 642, in truetype return freetype(font) File "/usr/lib/python3/dist-packages/PIL/ImageFont.py", line 639, in freetype return FreeTypeFont(font, size, index, encoding, layout_engine) File "/usr/lib/python3/dist-packages/PIL/ImageFont.py", line 187, in __init__ self.font = core.getfont( OSError: cannot open resource

tungs0ul commented 3 years ago

I have fixed the problem but now I ran into another problem bbox = draw.multiline_textbbox((0, 0), text_wrap, font=fontPIL) AttributeError: 'ImageDraw' object has no attribute 'multiline_textbbox'

goshawk111 commented 3 years ago

I think it's because the Pillow version is old. Version 8.0.0 or higher is required.

https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html#PIL.ImageDraw.ImageDraw.multiline_textbbox