Comments (7)
Yeah, I found this too. show=True only really works when you are not subclassing Canvas.
How do other toolkits deal with this? I would be surprised if the deffered the showing till the app is run.
A solution (I think) is to do the Canvas.init(self) at the end of your new init.
from vispy.
atom.py now demonstrates how you would do this. Dereferencing the showing until the app is run is non-trivial at best.
from vispy.
I think it is not really fixed even though the atom example show a workaround.
from vispy.
But I do not think it is a bug of vispy. This behaviour is inherent to how window creation works.
In theory, we could keep a list of windows-to-show on the app. The Canvas can add itself to the list. On app.run() all canvas objects in the list are shown. However, this will fail if a Canvas is created while the mainloop is running, for instance when a button is pressed and a popup with a visualization is shown.
from vispy.
But this means we cannot make the windows visible by default, no ?
On Aug 29, 2013, at 10:22 AM, Almar Klein [email protected] wrote:
But I do not think it is a bug of vispy. This behaviour is inherent to how window creation works.
In theory, we could keep a list of windows-to-show on the app. The Canvas can add itself to the list. On app.run() all canvas objects in the list are shown. However, this will fail if a Canvas is created while the mainloop is running, for instance when a button is pressed and a popup with a visualization is shown.
Reply to this email directly or view it on GitHub:
#39 (comment)
from vispy.
We can, but when subclassing Canvas, you need to take into account that the call to Canvas.__init__(self, **kwargs)
may invoke a call to some of the event handlers. So you probably want to do that after you've initialized stuff (as shown in atom.py).
And this should also just work:
MyCanvas(app.Canvas):
def __init__(self):
app.Canvas.__init__(self) # No show here
.... init stuff
self.show()
def on_paint(self):
... etc.
And so does this:
canvas = Canvas(show=True)
@canvas.connect
def on_paint(event):
....
from vispy.
Ok, great. I think we can close it.
Nicolas
On Aug 29, 2013, at 11:24 AM, Almar Klein [email protected] wrote:
We can, but when subclassing Canvas, you need to take into account that the call to
Canvas.__init__(self, **kwargs)
may invoke a call to some of the event handlers. So you probably want to do that after you've initialized stuff (as shown in atom.py).And this should also just work:
MyCanvas(app.Canvas):
def init(self):
app.Canvas.init(self) # No show here
.... init stuff
self.show()def on_paint(self): ... etc.
And so does this:
canvas = Canvas(show=True)
@canvas.connect
def on_paint(event):
....
Reply to this email directly or view it on GitHub:
#39 (comment)
from vispy.
Related Issues (20)
- Writing text in a gloo canvas (vispy.app.canvas) HOT 11
- Using `QT_SCALE_FACTOR` causes a cropped canvas (Qt backend) HOT 4
- in (/vispy/visuals /surface_plot.py) line 129 HOT 2
- How to render canvas with original pixel values? HOT 13
- The case where the scan lines are parallel to the sides of the rectangle HOT 1
- Cannot find Quartz library on MacOS Sonoma HOT 18
- Issue with Image Clipping in Multiple Viewboxes HOT 3
- how can i disable the canvas border HOT 2
- No setter for some properties of Arrow or Line after instantiation HOT 3
- Question regarding datoviz, backends, gtk HOT 5
- destructive behaviour when lines overlap HOT 1
- Errorous behavior in Vispy.Visuals.Markers.set_data HOT 2
- grid solver constraint not working HOT 4
- Running vispy inside docker and not being able to access OpenGL drivers HOT 1
- SurfacePlotVisual.set_data cause vertex shader to perform unnecessary build HOT 3
- Looking for additional maintainers HOT 12
- vispy flickering on Windows with real time data HOT 12
- How to use a canvas decorator inside a custom class HOT 2
- How to change shortcut for camera Interaction in vispy HOT 2
- VisPy does not work properly if QtWebEngineWidgets is imported HOT 4
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 vispy.