Re: Drawing electronic circuits or schematics with schemdraw Python package in a wxPython GUI

Dietmar Schwertberger <[email protected]> Fri, 26 Nov 2021 17:32:42 +0100
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------WfMWubBbUYNQAxFL4P0hfOuE
Content-Type: text/plain; charset="UTF-8"; format=flowed

On 26.11.2021 10:13, Matthias Brennwald wrote:
> 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

-- 
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 [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/30378c41-0bd1-00b2-c985-498010420a60%40schwertberger.de.

--------------WfMWubBbUYNQAxFL4P0hfOuE
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-8=
">
  </head>
  <body>
    <div class=3D"moz-cite-prefix">On 26.11.2021 10:13, Matthias Brennwald
      wrote:<br>
    </div>
    <blockquote type=3D"cite"
cite=3D"mid:[email protected]=
l.com">
      <meta http-equiv=3D"content-type" content=3D"text/html; charset=3DUTF=
-8">
      <div class=3D"gmail_quote">
        <div>Not sure what you mean here. Something else than wxPython?
          Something else than SVG? Or something else? <br>
        </div>
      </div>
    </blockquote>
    <p>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.<br>
    </p>
    <br>
    <blockquote type=3D"cite"
cite=3D"mid:[email protected]=
l.com">
      <div dir=3D"ltr">
        <div class=3D"gmail_quote">
          <div>The wxPython Demo is a bit tricky to get hold of, at
            least in my Linux environment. The instructions at <a
              href=3D"https://wxpython.org/pages/downloads/index.html"
              moz-do-not-send=3D"true" class=3D"moz-txt-link-freetext">http=
s://wxpython.org/pages/downloads/index.html</a>
            are a bit sketchy when it comes to Linux.</div>
        </div>
      </div>
    </blockquote>
    <p>Well, there's the section "Extra Files".<br>
      You can just download it from here and unpack it to your user
      directory and run from there by "python demo.py":<br>
<a class=3D"moz-txt-link-freetext" href=3D"https://extras.wxpython.org/wxPy=
thon4/extras/4.0.0/wxPython-demo-4.0.0.tar.gz">https://extras.wxpython.org/=
wxPython4/extras/4.0.0/wxPython-demo-4.0.0.tar.gz</a></p>
    <p><br>
    </p>
    <blockquote type=3D"cite"
cite=3D"mid:[email protected]=
l.com">
      <div dir=3D"ltr">
        <div class=3D"gmail_quote">
          <div>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.<br>
          </div>
        </div>
      </div>
    </blockquote>
    <p>Your code looks good for me.</p>
    <p>Regards,</p>
    <p>Dietmar<br>
    </p>
  </body>
</html>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;wxPython-users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">wxpy=
[email protected]</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/wxpython-users/30378c41-0bd1-00b2-c985-498010420a60%40schwertber=
ger.de?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/=
msgid/wxpython-users/30378c41-0bd1-00b2-c985-498010420a60%40schwertberger.d=
e</a>.<br />

--------------WfMWubBbUYNQAxFL4P0hfOuE--