Comments (3)
Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).
You might want to review how modules are imported and where from in Python (https://docs.python.org/3/tutorial/modules.html#the-module-search-path). You’ll also need to create an __init__.py
file in the directory so Python will see it.
The plugin mechanism in Tuiview is pretty basic - it just loads the file and doesn’t make any other part of your source tree “import-able”. You need to do this yourself. I would recommend creating a Python package (https://packaging.python.org/tutorials/packaging-projects/) called foo
or whatever with your plugin support code and install it (either in the default location or on your $PYTHONPATH
). Then in your plugin import that module and call what you need.
from tuiview-plugins.
Original comment by Abhisek Maiti (Bitbucket: [Abhisek Maiti](https://bitbucket.org/Abhisek Maiti), ).
I should have explained myself properly. My directory structure is as follows:
|-- tuiview_plugins/demo_plugin
|-- __init__.py
|-- demo_plugin.py
|-- foo
| |-- __init__.py
| |-- bar.py
I do have a __init__.py
inside foo
. From the demo_plugin.py
, I am using from <dot_delimited_path_from_cwd>.foo.bar import *
to import the module, where cwd
signifies current working directory. I also tried changing the working directory to tuiview_plugins/demo_plugin
first and then import using foo.bar import *
. Both the approaches did not work. However, both approaches work when simulating the same situation in python
console.
Since the recommended approach is to package and install the additional modules I will try that.
I have another query if you don’t mind, if I want my plugin to have GUI (something like dialog box / wizard etc.) what is the correct / recommended way to implement that? I am trying to develop a plugin to classify temporal image stack and visualize in tuiview
.
from tuiview-plugins.
Original comment by Sam Gillingham (Bitbucket: gillins, GitHub: gillins).
I suspect you need to add the path to tuiview_plugins/demo_plugin/foo
to your $PYTHONPATH
It’s probably working in the console because it is looking relative to your current directory. From inside TuiView, it will be looking relative to where TuiView is installed which isn’t much help to you. But yes package is probably easiest.
I don’t have any particular advice about developing GUIs. You will need to use PyQt5 to be compatible with TuiView and there are plenty of examples online (http://zetcode.com/gui/pyqt5/ is a good start). Of course there is plenty of code in TuiView itself you may be able to use as a guide.
Good luck!
from tuiview-plugins.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tuiview-plugins.