RE: Drawing electronic circuits or schematics with schemdraw Python package in a wxPython GUI
Steve Barnes <[email protected]> Fri, 26 Nov 2021 17:30:01 +0000
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <VI1PR03MB65755EEC54F256ADD1D4DC7F9B639@VI1PR03MB6575.eurprd03.prod.outlook.com> |
--_000_VI1PR03MB65755EEC54F256ADD1D4DC7F9B639VI1PR03MB6575eurp_ Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Dietmar, Following installing wxPython the command wxdemo should download (if not al= ready 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 t= hat you may have. Likewise the command wxdocs should download (if not alrea= dy done), unpack (if not already done) and open in the default browser the = documents for the current version of wxpython. Both of these should automat= ically be installed in the python/Scripts location when you pip install wxP= ython. I put this together because of the aforementioned tricky bits and was delig= hted when they made it into the official distribution so if they have stopp= ed working then please let me know. Steve Barnes From: [email protected] <[email protected]> On = Behalf Of Dietmar Schwertberger Sent: 26 November 2021 16:33 To: [email protected] Subject: Re: [wxPython-users] Drawing electronic circuits or schematics wit= h schemdraw Python package in a wxPython GUI On 26.11.2021 10:13, Matthias Brennwald wrote: Not sure what you mean here. Something else than wxPython? Something else t= han 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 w= ay, i.e. draw the elements. But from your posting I understood that you jus= t want to display some static image. The wxPython Demo is a bit tricky to get hold of, at least in my Linux envi= ronment. The instructions at https://wxpython.org/pages/downloads/index.htm= l<https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fwxpy= thon.org%2Fpages%2Fdownloads%2Findex.html&data=3D04%7C01%7C%7Ca3072f0974b44= 069eb9508d9b0fa61dd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C6377354116= 93133136%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTi= I6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3Dbz9IVDe%2FkX1NW%2BoNn4e3atXQ2d%2BwT= xDCoWdXwthyIlk%3D&reserved=3D0> 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<https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fext= ras.wxpython.org%2FwxPython4%2Fextras%2F4.0.0%2FwxPython-demo-4.0.0.tar.gz&= data=3D04%7C01%7C%7Ca3072f0974b44069eb9508d9b0fa61dd%7C84df9e7fe9f640afb435= aaaaaaaaaaaa%7C1%7C0%7C637735411693133136%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM= C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3Dk3= AE51dAMR1Q%2BPinHFXsJdzvVT0eh%2FVKDd4XWQa4a2E%3D&reserved=3D0> 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 appre= ciate 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 e= mail to [email protected]<mailto:wxpython-users+u= [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<http= s://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgroups.goo= gle.com%2Fd%2Fmsgid%2Fwxpython-users%2F30378c41-0bd1-00b2-c985-498010420a60= %2540schwertberger.de%3Futm_medium%3Demail%26utm_source%3Dfooter&data=3D04%= 7C01%7C%7Ca3072f0974b44069eb9508d9b0fa61dd%7C84df9e7fe9f640afb435aaaaaaaaaa= aa%7C1%7C0%7C637735411693143091%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDA= iLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3D9bvwnKg9KqpE= ATeWH%2FE4xd5OSAPJHJJc7aIFp6LEwGY%3D&reserved=3D0>. --=20 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 e= mail to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/= wxpython-users/VI1PR03MB65755EEC54F256ADD1D4DC7F9B639%40VI1PR03MB6575.eurpr= d03.prod.outlook.com. --_000_VI1PR03MB65755EEC54F256ADD1D4DC7F9B639VI1PR03MB6575eurp_ Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr= osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" = xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:= //www.w3.org/TR/REC-html40"> <head> <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"= > <meta name=3D"Generator" content=3D"Microsoft Word 15 (filtered medium)"> <style><!-- /* Font Definitions */ @font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;} @font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; font-size:11.0pt; font-family:"Calibri",sans-serif;} a:link, span.MsoHyperlink {mso-style-priority:99; color:blue; text-decoration:underline;} span.EmailStyle19 {mso-style-type:personal-reply; font-family:"Calibri",sans-serif; color:windowtext;} .MsoChpDefault {mso-style-type:export-only; font-size:10.0pt;} @page WordSection1 {size:612.0pt 792.0pt; margin:72.0pt 72.0pt 72.0pt 72.0pt;} div.WordSection1 {page:WordSection1;} --></style><!--[if gte mso 9]><xml> <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" /> </xml><![endif]--><!--[if gte mso 9]><xml> <o:shapelayout v:ext=3D"edit"> <o:idmap v:ext=3D"edit" data=3D"1" /> </o:shapelayout></xml><![endif]--> </head> <body lang=3D"EN-GB" link=3D"blue" vlink=3D"purple" style=3D"word-wrap:brea= k-word"> <div class=3D"WordSection1"> <p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-US">Dietmar,<= o:p></o:p></span></p> <p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-US"><o:p>&nbs= p;</o:p></span></p> <p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-US">Following= installing wxPython the command wxdemo should download <i>(if not already done)</i>, unpack <i>(if not already done)</i> and run t= he 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 shoul= d download <i>(if not already done)</i>, unpack <i>(if not already done)</i> and open = in the default browser the documents for the current version of wxpython. B= oth of these should automatically be installed in the python/Scripts locati= on when you pip install wxPython.<o:p></o:p></span></p> <p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-US"><o:p>&nbs= p;</o:p></span></p> <p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-US">I put thi= s together because of the aforementioned tricky bits and was delighted when= they made it into the official distribution so if they have stopped workin= g then please let me know.<o:p></o:p></span></p> <p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-US"><o:p>&nbs= p;</o:p></span></p> <p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-US">Steve Bar= nes<o:p></o:p></span></p> <p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-US"><o:p>&nbs= p;</o:p></span></p> <div> <div style=3D"border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm = 0cm 0cm"> <p class=3D"MsoNormal"><b><span lang=3D"EN-US">From:</span></b><span lang= =3D"EN-US"> [email protected] <wxpython-users@googlegroups= .com> <b>On Behalf Of </b>Dietmar Schwertberger<br> <b>Sent:</b> 26 November 2021 16:33<br> <b>To:</b> [email protected]<br> <b>Subject:</b> Re: [wxPython-users] Drawing electronic circuits or schemat= ics with schemdraw Python package in a wxPython GUI<o:p></o:p></span></p> </div> </div> <p class=3D"MsoNormal"><o:p> </o:p></p> <div> <p class=3D"MsoNormal">On 26.11.2021 10:13, Matthias Brennwald wrote:<o:p><= /o:p></p> </div> <blockquote style=3D"margin-top:5.0pt;margin-bottom:5.0pt"> <div> <div> <p class=3D"MsoNormal">Not sure what you mean here. Something else than wxP= ython? Something else than SVG? Or something else? <o:p></o:p></p> </div> </div> </blockquote> <p>Something other than static bitmaps. E.g. if you want to build a schemat= ic designer, then you probably need to implement your main window in anothe= r way, i.e. draw the elements. But from your posting I understood that you = just want to display some static image.<o:p></o:p></p> <p class=3D"MsoNormal"><br> <br> <o:p></o:p></p> <blockquote style=3D"margin-top:5.0pt;margin-bottom:5.0pt"> <div> <div> <div> <p class=3D"MsoNormal">The wxPython Demo is a bit tricky to get hold of, at= least in my Linux environment. The instructions at <a href=3D"https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%= 2F%2Fwxpython.org%2Fpages%2Fdownloads%2Findex.html&data=3D04%7C01%7C%7C= a3072f0974b44069eb9508d9b0fa61dd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0= %7C637735411693133136%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV= 2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3Dbz9IVDe%2FkX1NW%2B= oNn4e3atXQ2d%2BwTxDCoWdXwthyIlk%3D&reserved=3D0"> https://wxpython.org/pages/downloads/index.html</a> are a bit sketchy when = it comes to Linux.<o:p></o:p></p> </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 href=3D"https://emea01.safelinks.protection.outlook.com/?url=3Dhttps%3A%= 2F%2Fextras.wxpython.org%2FwxPython4%2Fextras%2F4.0.0%2FwxPython-demo-4.0.0= .tar.gz&data=3D04%7C01%7C%7Ca3072f0974b44069eb9508d9b0fa61dd%7C84df9e7f= e9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637735411693133136%7CUnknown%7CTWFpbGZsb= 3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C300= 0&sdata=3Dk3AE51dAMR1Q%2BPinHFXsJdzvVT0eh%2FVKDd4XWQa4a2E%3D&reserv= ed=3D0">https://extras.wxpython.org/wxPython4/extras/4.0.0/wxPython-demo-4.= 0.0.tar.gz</a><o:p></o:p></p> <p><o:p> </o:p></p> <blockquote style=3D"margin-top:5.0pt;margin-bottom:5.0pt"> <div> <div> <div> <p class=3D"MsoNormal">That said, I managed to get the schemdraw PNG data t= o display in a wx panel. I believe the trick is convert the schemdraw PNG d= ata 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 tho= ughts on this.<o:p></o:p></p> </div> </div> </div> </blockquote> <p>Your code looks good for me.<o:p></o:p></p> <p>Regards,<o:p></o:p></p> <p>Dietmar<o:p></o:p></p> <p class=3D"MsoNormal">-- <br> You received this message because you are subscribed to the Google Groups &= quot;wxPython-users" group.<br> To unsubscribe from this group and stop receiving emails from it, send an e= mail to <a href=3D"mailto:[email protected]">wxpython-use= [email protected]</a>.<br> To view this discussion on the web visit <a href=3D"https://emea01.safelink= s.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid= %2Fwxpython-users%2F30378c41-0bd1-00b2-c985-498010420a60%2540schwertberger.= de%3Futm_medium%3Demail%26utm_source%3Dfooter&data=3D04%7C01%7C%7Ca3072= f0974b44069eb9508d9b0fa61dd%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C63= 7735411693143091%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMz= IiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=3D9bvwnKg9KqpEATeWH%2FE4x= d5OSAPJHJJc7aIFp6LEwGY%3D&reserved=3D0"> https://groups.google.com/d/msgid/wxpython-users/30378c41-0bd1-00b2-c985-49= 8010420a60%40schwertberger.de</a>.<o:p></o:p></p> </div> </body> </html> <p></p> -- <br /> You received this message because you are subscribed to the Google Groups &= quot;wxPython-users" 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/VI1PR03MB65755EEC54F256ADD1D4DC7F9B639%40VI1PR03M= B6575.eurprd03.prod.outlook.com?utm_medium=3Demail&utm_source=3Dfooter">htt= ps://groups.google.com/d/msgid/wxpython-users/VI1PR03MB65755EEC54F256ADD1D4= DC7F9B639%40VI1PR03MB6575.eurprd03.prod.outlook.com</a>.<br /> --_000_VI1PR03MB65755EEC54F256ADD1D4DC7F9B639VI1PR03MB6575eurp_--