I was thinking that a vector graphics format would be better in view of different (high) DPI environments. However, PNG (or other bitmap formats) are not necessarily out of question if there is no good way with vector graphics.
That's only relevant if you want e.g. to zoom and edit or if Schemdraw does no good job in rendering into the image.
If you want to zoom etc., i.e. you want to edit your schematics,
then you should look into something else anyway.
Maybe look at KiCad, which uses wx.
How could I make use of the PNG output from schemdraw in wxPython? The PNG examples I found for wxPython always make use of a PNG file as the source for the image data.
Have a look at the "Using Images" section of the wxPython demo and also at the wxPython documentation.
Why are you "stuck at 4.0"? It's not too hard to upgrade or to
use project specific versions.
Regards,
Dietmar
On 25.11.2021 19:33, Matthias Brennwald wrote:
I was thinking that a vector graphics format would be better in view of different (high) DPI environments. However, PNG (or other bitmap formats) are not necessarily out of question if there is no good way with vector graphics.That's only relevant if you want e.g. to zoom and edit or if Schemdraw does no good job in rendering into the image.
If you want to zoom etc., i.e. you want to edit your schematics, then you should look into something else anyway.
How could I make use of the PNG output from schemdraw in wxPython? The PNG examples I found for wxPython always make use of a PNG file as the source for the image data.Have a look at the "Using Images" section of the wxPython demo and also at the wxPython documentation.
Why are you "stuck at 4.0"? It's not too hard to upgrade or to use project specific versions.
Not sure what you mean here. Something else than wxPython? Something else than SVG? Or something else?
Something other than static bitmaps. E.g. if you want to build a
schematic designer, then you probably need to implement your main
window in another way, i.e. draw the elements. But from your
posting I understood that you just want to display some static
image.
The wxPython Demo is a bit tricky to get hold of, at least in my Linux environment. The instructions at https://wxpython.org/pages/downloads/index.html are a bit sketchy when it comes to Linux.
Well, there's the section "Extra Files".
You can just download it from here and unpack it to your user
directory and run from there by "python demo.py":
https://extras.wxpython.org/wxPython4/extras/4.0.0/wxPython-demo-4.0.0.tar.gz
That said, I managed to get the schemdraw PNG data to display in a wx panel. I believe the trick is convert the schemdraw PNG data to a stream, which can then feed into wx.ImageFromStream(...). I added a small self-contained example below (code inspired by googling for examples by others). I'd appreciate any thoughts on this.
Your code looks good for me.
Regards,
Dietmar
Dietmar,
Following installing wxPython the command wxdemo should download (if not already done), unpack (if not already done) and run the demo for the current version of wxPython - if it doesn't I would welcome any debug information that you may have. Likewise the command wxdocs should download (if not already done), unpack (if not already done) and open in the default browser the documents for the current version of wxpython. Both of these should automatically be installed in the python/Scripts location when you pip install wxPython.
I put this together because of the aforementioned tricky bits and was delighted when they made it into the official distribution so if they have stopped working then please let me know.
Steve Barnes
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
wxpython-user...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/wxpython-users/30378c41-0bd1-00b2-c985-498010420a60%40schwertberger.de.