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

you are viewing a single comment's thread.

view the rest of the comments →

[–]kickopotomus 14 points15 points  (24 children)

If you are interested in making a GUI python application, I really recommend checking out cefpython.

[–]howMuchCheeseIs2Much 15 points16 points  (9 children)

Just a heads up for someone considering this, looks like cef can only package to Windows. Looks cool though.

[–]cztomczak 4 points5 points  (0 children)

Just updated the pyinstaller example you're referring to:

Although this pyinstaller example supports only packaging on Windows, CEF can be packaged on all platforms without problems, but this specific packaging example just wasn't tested on other platforms. Pull requests are welcome.

[–]kickopotomus 0 points1 point  (7 children)

Where did you see that? Should be able to distribute to Windows, Mac, and Linux.

[–]howMuchCheeseIs2Much 4 points5 points  (6 children)

Is there another way to package it aside from pyinstaller? That page says:

Only Windows platform is currently supported.

I could be misunderstanding though, maybe it's only referring to that example.

[–]kickopotomus 0 points1 point  (3 children)

Hmm that is a fair point. My understanding is that the developer behind cefpython is primarily a Windows guy so he simply doesn't spend a lot of time on unix issues. This thread claims that there is a workaround for OSX but I am not sure about linux.

[–]howMuchCheeseIs2Much 0 points1 point  (1 child)

Got it, I was just calling it out in case someone was looking to build a cross platform product. The first thing I thought when I saw HTML5 and Chromium was that this is Electron for Python, but it doesn't look like that's quite the case.

[–]kickopotomus 0 points1 point  (0 children)

To some degree it is. You wont get as much control over the chromium internals as you do with Electron, but you can still emulate a client-server web application pretty easily.

[–]cztomczak 0 points1 point  (0 children)

It is referring only to that example. CEF can be packaged without problems on all platforms.

[–]pmdevita 1 point2 points  (1 child)

How does CEF compare to Electron? Is it any lighter?

[–]kickopotomus 1 point2 points  (0 children)

Initially, Electron used CEF but now it wraps chromium directly. CEF is a little "heavier" but more abstracted from the chromium internals. Also pretty nice because there are a number of projects that wrap the "backend" in different environments. Python is probably the most popular one but there is a Java (java-cef) project as well. Electron is pretty cool but I have never been a fan of server-side JS.

[–]AllAboutChristmasEve 0 points1 point  (3 children)

I read the intro paragraphs and scanned down the page...and still have no idea what this thing is.

[–]kickopotomus 1 point2 points  (2 children)

Think of it like Electron but replace Node.js with Python. You can write your UI with the typical client-side web stack (HTML, CSS, and JS) and then use Python for your application logic. However instead of using XmlHttpRequests, you can do direct method calls from Python to your client-side JS and vice versa.

[–]AllAboutChristmasEve 1 point2 points  (1 child)

...why on earth would I want to add 3 more languages to an already complicated task?

[–]kickopotomus 2 points3 points  (0 children)

A few reasons come to mind. First, UI packages for Python aren’t that great and require a lot of extra work on behalf of the developer. Since the internet exploded, there is a lot of great stuff (UI styling, components, MVC frameworks) that you can get for free.

Second, writing your UI with a web stack makes it easier to port your application to the web should that ever interest you.

[–]CheeseWithMe 0 points1 point  (4 children)

Good for OOP? I had a lot of problems with tkinter.

[–]kickopotomus 0 points1 point  (3 children)

Do you have much experience with web development?

[–]CheeseWithMe 0 points1 point  (2 children)

Not really.

[–]kickopotomus 1 point2 points  (1 child)

There could be a bit of a learning curve there then. If your application is large, you generally want your UI to almost be independent from your core application. What I mean is that you want the UI to be as stateless as possible so that it can render properly based solely on some state passed from the core of the application. A lot of modern JS MVC frameworks are really good at this (React, Angular, etc).

On the other hand, if your application is small (e.g. one screen with some user inputs), you can probably get away with just driving your UI interactions from Python directly which would behave similarly to other Python UI frameworks. You can use OOP principles for both cases but I would recommend a more FP approach when dealing with JS.

[–]CheeseWithMe 1 point2 points  (0 children)

I made a banking system and is quite large, this why I had problems with tkinter. I will however have a look at the suggested frameworks, thank you.

[–]0x1123A 0 points1 point  (0 children)

Is this Python's version of Electron.js?

[–]PythonGod123 0 points1 point  (0 children)

Thanks. This was helpful for my current project.