TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Using websockets to easily build GUIs for Python programs

79 点作者 jsomers超过 6 年前

13 条评论

userbinator超过 6 年前
Keep that in mind &quot;easily&quot; can be good for you, but not for your users---<p><a href="https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;tonyschr&#x2F;2004&#x2F;03&#x2F;30&#x2F;drivers-a-new-kind-of-bloat&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blogs.msdn.microsoft.com&#x2F;tonyschr&#x2F;2004&#x2F;03&#x2F;30&#x2F;drivers...</a><p>Even if it&#x27;s just restricted to the local machine, any application that seemingly should have nothing to do with the network is going to arouse plenty of unneeded suspicion if it starts listening on a port or creating connections. Several years ago I remember coming across an application written in Python that did something similar, and its forums had users complaining that their firewall had detected something or that it was otherwise not working. I downloaded the executable, analysed it to discover the above, and decided to find an alternative instead.
评论 #18104620 未加载
amasad超过 6 年前
There&#x27;s a Python library for this called &quot;remi&quot;[1]: REMote Interface library. It&#x27;s amazing how well it works. We&#x27;ve been playing around with it on repl.it because we have a lot of users asking for GUI.<p>I recently built a TicTacToe game[2] in it in the fraction of the time it would take me just to setup a webapp. It&#x27;s pretty impressive and goes to show how badly setup the web is for apps.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;dddomodossola&#x2F;remi" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dddomodossola&#x2F;remi</a><p>[2]: <a href="https:&#x2F;&#x2F;repl.it&#x2F;talk&#x2F;share&#x2F;Tic-Tac-Toe-in-remi-a-cross-platform-Python-Remote-GUI-Library&#x2F;6145" rel="nofollow">https:&#x2F;&#x2F;repl.it&#x2F;talk&#x2F;share&#x2F;Tic-Tac-Toe-in-remi-a-cross-platf...</a>
评论 #18102941 未加载
abhinai超过 6 年前
This is an idea in the right direction! HTML5&#x2F;Javascript&#x2F;CSS stack is great for making UI. So much effort has been poured into making this stack great that it makes all the sense in the world to make it a standard GUI stack.<p>Now we need a good connector library so that we can program in any language of our choice and use the web stack for seamless display. Web sockets are a good start but we could do better.
评论 #18102225 未加载
renegadus超过 6 年前
I&#x27;ve been working on something similar in Kotlin called <a href="http:&#x2F;&#x2F;kweb.io&#x2F;" rel="nofollow">http:&#x2F;&#x2F;kweb.io&#x2F;</a>. It works but is still pre-1.0. You can manipulate a remote DOM as if it was local to the server and attach event listeners. Feedback welcome.
mangecoeur超过 6 年前
This is pretty much what bokeh ( <a href="https:&#x2F;&#x2F;bokeh.pydata.org&#x2F;en&#x2F;latest&#x2F;" rel="nofollow">https:&#x2F;&#x2F;bokeh.pydata.org&#x2F;en&#x2F;latest&#x2F;</a> ) does, there&#x27;s Holoviews higher level plotting interfaces built on it too ( <a href="http:&#x2F;&#x2F;holoviews.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;holoviews.org&#x2F;</a> )
评论 #18102729 未加载
fromthestart超过 6 年前
I&#x27;ve been something of a full stack developer for about 10 years now, my bread and butter being Python and c#, with a background in c++. The handful of times I&#x27;ve tried writing a web based UI for python and c# applications have been exercises in frustration.<p>Web is a cancer on tech. A giant, bloated, broken mess, built emergently, without any cohesiveness or vision. Simple applications come with hundreds of external dependencies, many of which regularly release breaking updates. It is simply impossible to consistently find up to date documentation on best usage for many of these libraries because of the speed with which the space moves, not necessarily toward anything good. Not to mention the incredibly dangerous nature of such a loosly typed language like JavaScript.<p>In my opinion, the whole system needs to be burnt to the ground to make way for something cleaner, safer, and more secure.<p>Then again, maybe I&#x27;m just biased by my preference for backend coding.
Per_Bothner超过 6 年前
The DomTerm terminal emulator (<a href="https:&#x2F;&#x2F;domterm.org" rel="nofollow">https:&#x2F;&#x2F;domterm.org</a>) also uses WebSockets. The &quot;server&quot; is written in C, and handles pttys, command processing, help, and more. It uses libwebsockets (<a href="https:&#x2F;&#x2F;libwebsockets.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;libwebsockets.org&#x2F;</a>) in the server. JavaScript in the browser (or something browser-like such as Electron) handles the GUI, including xterm&#x2F;ansi escape sequences, menus, panes, buttons, etc.
rad_gruchalski超过 6 年前
Is there anything preventing other applications from connecting to the web socket server and messing up with the application state? Or is that possible &quot;by design&quot;?
评论 #18102607 未加载
pq0ak2nnd超过 6 年前
Local UI?<p>electron + ES6 + html5 + no package installs + linux&#x2F;macos&#x2F;windows portable = why bother with anything else?
评论 #18102680 未加载
dxxvi超过 6 年前
My use case is the same, but my local ui is composed of angular + websocket. It seems to me that when the browser (Firefox) tab containing the websocket is inactive, the websocket doesn&#x27;t run. Not sure if it&#x27;s because of any bug in my app or because of Firefox.
itronitron超过 6 年前
I&#x27;ve recently started on this approach as well for hooking up a computational backend in Java to D3 based visualizations in the browser. Netbeans has several good introductory websocket examples that are a good starting point for setting up the socket connection.
nurettin超过 6 年前
Websockets are known to happily drop packages in bad connectivity situations. I&#x27;d prefer something more robust like mqtt or stomp over ws.
评论 #18101606 未加载
评论 #18101769 未加载
colek42超过 6 年前
Be careful, web sockets require state which causes issues when scaling.
评论 #18101622 未加载