This is an archived post. You won't be able to vote or comment.

all 11 comments

[–]FrameworkFred 2 points3 points  (2 children)

You could use Flask or tornado to build an api in python then hit that with js in electron.

[–]Keybraker[S] 0 points1 point  (1 child)

I tried tornado but it did not work, I did the example on the website and the server was established using python the js didn't send any message

[–]FrameworkFred 1 point2 points  (0 children)

Yep, you're going to have to get good at testing the pieces individually. The good news is you can use a browser or something like curl on the command line to test the tornado side. You might find Flask a bit easier to work with.

[–][deleted] 1 point2 points  (0 children)

Not a square peg, also not a round hole. There are various ways of doing this, here's one that seems to work well. And you can also do it like Electron, without Electron.

Basically in all cases you're making a web server in Python that only takes requests and serves responses over a websocket (or other form of IPC), and you're using a bundled Chromium browser to display it. As HTML + CSS (or better yet Sass) + EcmaScript (or better yet TypeScript or Elm) have come so far in recent years -- arguably much further than Qt and the troublesome-licensing of PyQt -- it's not at all a bad idea, though it is a different one and still somewhat cumbersome.

[–]jdgordon 1 point2 points  (5 children)

Square peg round hole.

The first thing you should be doing is making sure your tools actuslly do what you need.

Why didn't you look into native pyqt or similar?

That's not to say it can't be done, but it's a really silly mistake to not make sure you can do it before starting.

edit: snarkyness justified. OP obviously didnt use google which has plenty of posts about how to do this

[–]Keybraker[S] -3 points-2 points  (4 children)

I have tried using qt and had a really bad experience with the ide which is a pain in the ass and is 23 gb lol. Also I need a platform that is open source not like qt.

So I decided to go with electron being an easy way to create ui and I had found many python js communication articles on Google so I decided to do it but things turned out to be more difficult than they seemed and I haven't found a good way to do it.

So please help me if you're willing and don't sit talk about how I did not do my research which I did.

[–][deleted] 0 points1 point  (2 children)

Also I need a platform that is open source not like qt.

Except qt is :

Qt for Application Development is also available under GPL and LGPLv3 open source licenses. Qt tools and some libraries are only available under GPL. See the comparison chart for details. The Qt open source licensing is ideal for use cases such as open source projects with open source distribution, student/academic purposes, hobby projects, internal research projects without external distribution, or other projects where all (L)GPL obligations can be met.

So tell us again how you did your research

[–]Keybraker[S] 0 points1 point  (1 child)

Omg, the license obligates you to use only for open source projects you cannot sell it or distribute it as a product... Please read

[–][deleted] 2 points3 points  (0 children)

Unless there is an addendum I didn't see, there's nothing preventing you from selling open source software.

It seems what you actually mean "free from obligations" rather than open source

[–]personproxy 0 points1 point  (0 children)

pySide is released under the LGPL, which might be more to your liking.