Discussion:
[Pyzo] possible to use Pyzo editor/components in another program?
Vince West
2017-10-11 18:54:58 UTC
Permalink
I'm working on a PyQt5 pandas/gui application. Ultimately the plan is to
have some capability to write and store small scripts (like some plotting
scripts or whatever) that are internal to the application. I could use just
a PlainTextEdit, but I quite like the Pyzo editor, and was wondering if I
could just do something like this:

import sys

from PyQt5 import QtCore, QtWidgets
from pyzo.core import editor

qApp = QtWidgets.QApplication(sys.argv)

form = QtWidgets.QWidget()
layout = QtWidgets.QVBoxLayout(form)
editor = editor.PyzoEditor(form)
layout.addWidget(editor)

form.show()
sys.exit(qApp.exec_())

This code throws an uncaught exception:

Uncaught Python exception: module 'pyzo' has no attribute 'icons'
File "C:/Coding/Python/dataquick/sandbox/pyzo_editor.py", line 10, in
<module>
editor = editor.PyzoEditor(form)
File "C:\Miniconda3\lib\site-packages\pyzo\core\editor.py", line 285, in
__init__
self._menu = EditorContextMenu(self)
File "C:\Miniconda3\lib\site-packages\pyzo\core\menu.py", line 1201, in
__init__
Menu.__init__(self, editor, name)
File "C:\Miniconda3\lib\site-packages\pyzo\core\menu.py", line 207, in
__init__
self.build()
File "C:\Miniconda3\lib\site-packages\pyzo\core\menu.py", line 1206, in
build
icons = pyzo.icons

Before I go too far down the rabbit hole, I'm wondering a few things
1) is Pyzo sufficiently modular to use the pieces directly from the package?
2) Could I do this with the embedded interpreter also, but this time use
the interpreter to play with the application itself? (i.e. if I am making
dataapp, and embed a pyzo console into dataapp, I'd like the pyzo console
to have some local variable access to some data objects inside datapp)

I have been looking over the code for a bit now. I am wondering if there
are any quick tips on executing this.

Thanks
Vince West
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Almar Klein
2017-10-13 08:19:26 UTC
Permalink
Hi!

Nice to see someone hacking with Pyzo in this way :)

The code editor component is actually written to be modular, so I
*think* this should work:
from pyzo.codeeditor import CodeEditor

As for keyboard shortcuts, these are rather central to the application,
making it hard to modularize; you'd probably have to implement your own
menu.

As for the shell, I have done no attempt to make this modular. However,
have a look at the logger tool, which is essentially a shell in the app
itself, which seems to be what you're looking for.

Regards,
  Almar
I'm working on a PyQt5 pandas/gui application. Ultimately the plan is
to have some capability to write and store small scripts (like some
plotting scripts or whatever) that are internal to the application. I
could use just a PlainTextEdit, but I quite like the Pyzo editor, and
import sys
from PyQt5 import QtCore, QtWidgets
from pyzo.core import editor
qApp = QtWidgets.QApplication(sys.argv)
form = QtWidgets.QWidget()
layout = QtWidgets.QVBoxLayout(form)
editor = editor.PyzoEditor(form)
layout.addWidget(editor)
form.show()
sys.exit(qApp.exec_())
Uncaught Python exception: module 'pyzo' has no attribute 'icons'
  File "C:/Coding/Python/dataquick/sandbox/pyzo_editor.py", line 10,
in <module>
    editor = editor.PyzoEditor(form)
  File "C:\Miniconda3\lib\site-packages\pyzo\core\editor.py", line
285, in __init__
    self._menu = EditorContextMenu(self)
  File "C:\Miniconda3\lib\site-packages\pyzo\core\menu.py", line 1201,
in __init__
Menu.__init__(self, editor, name)
  File "C:\Miniconda3\lib\site-packages\pyzo\core\menu.py", line 207,
in __init__
    self.build()
  File "C:\Miniconda3\lib\site-packages\pyzo\core\menu.py", line 1206,
in build
    icons = pyzo.icons
Before I go too far down the rabbit hole, I'm wondering a few things
1) is Pyzo sufficiently modular to use the pieces directly from the package?
2) Could I do this with the embedded interpreter also, but this time
use the interpreter to play with the application itself?  (i.e. if I
am making dataapp, and embed a pyzo console into dataapp, I'd like the
pyzo console to have some local variable access to some data objects
inside datapp)
I have been looking over the code for a bit now.  I am wondering if
there are any quick tips on executing this.
Thanks
Vince West
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Pyzo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyzo+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...