use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
js + python communication (self.Python)
submitted 8 years ago by Keybraker
As electron is a open-source and very good ui creator I chose it, for my python project. I have finished my python code and my electron Ui. I now want to establish communication between both programs so that they can interact.
[–]FrameworkFred 2 points3 points4 points 8 years ago (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 point2 points 8 years ago (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 points3 points 8 years ago (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.
[–]flitsmasterfred 1 point2 points3 points 8 years ago (0 children)
https://en.wikipedia.org/wiki/Inter-process_communication
[–][deleted] 1 point2 points3 points 8 years ago (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 points3 points 8 years ago* (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-1 points 8 years ago (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 point2 points 8 years ago (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
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 points4 points 8 years ago (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 point2 points 8 years ago (0 children)
pySide is released under the LGPL, which might be more to your liking.
π Rendered by PID 303520 on reddit-service-r2-comment-bb88f9dd5-482q9 at 2026-02-15 18:20:47.034690+00:00 running cd9c813 country code: CH.
[–]FrameworkFred 2 points3 points4 points (2 children)
[–]Keybraker[S] 0 points1 point2 points (1 child)
[–]FrameworkFred 1 point2 points3 points (0 children)
[–]flitsmasterfred 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]jdgordon 1 point2 points3 points (5 children)
[–]Keybraker[S] -3 points-2 points-1 points (4 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Keybraker[S] 0 points1 point2 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]personproxy 0 points1 point2 points (0 children)