T
T
TK2019-05-30 21:54:30
Python
TK, 2019-05-30 21:54:30

Is it possible to make a frontend in Python?

Good day
Sorry for the stupid question (probably) But is it possible to make a frontend in Python? or does it fit better on the backend?

Answer the question

In order to leave comments, you need to log in

9 answer(s)
A
Alexey Guest007, 2019-06-06
@Turarbek

In a client-server architecture, the backend is what runs on the server. Frontend - what works for the client ("thick client").
And this and that can be written on anything, if there are appropriate mechanisms.
Backend - Python. This is fine. The universal version returns data on request and does not worry about how they will be visualized. REST, GraphQL, SOAP, etc.
Frontend, working on the client side, visualizes the received data for the user. Here, both native rendering and indirect rendering (for example, through a browser) are possible.
The frontend is written separately from the backend. Tool - any suitable.
To render through a browser (here, the Toaster site, for example), you need to write a client in HTML / CSS / JS. It will be loaded into the browser and drawn by means of it.
For native rendering - any lib corresponding to the system. At least MFC is in Windows (although this is already necromancy - now .NET libraries are in favor), at least Carbon (or what is there now on the Mac?).
From Linux native (they are also cross-platform), GTK, Qt, FLTK and various add-ons above them are suitable. WxWidget is the same...
I'm not touching the topic of mobile devices yet...
Therefore, if you don't want to learn different languages, but limit yourself to Python, then you CAN write on it. There are bindings for GTK and Qt. There is WxPython. For mobile phones, you can immerse yourself in the marvelous and wonderful world of Kivy (although this is rather a cross-platform solution - it will work on desktops as well). BeeWare is also developing interestingly.
But if writing a web client is meant, then learning JS will take less time than fruitless attempts to use the wrong tool.

S
Sanes, 2019-05-30
@Sanes

Frontend is HTML/CSS/JS

S
Sergey Kotov, 2019-05-30
@liqrizz

write your own browser with python support and I think it will be possible

M
Moskus, 2019-05-30
@Moskus

The front end is what works in the user's browser.
Python doesn't work in browser.
Hence the conclusion: no, you can't.

V
Vladimir Proskurin, 2019-05-30
@Vlad_IT

Well, there are probably various translators (or compilers, whatever you want to call it) that convert python code to JS. But you see, the language is part of the ecosystem, and you will have difficulty using other people's libraries that use their types (their own type conversion nuances), and it's not a fact that you can use other people's libraries at all.
Therefore, it seems to me that you will later regret a million times that you began to use such a "crutch". Learn JS, sometimes it's good to learn other programming languages.

E
Egor Kazantsev, 2019-05-31
@saintbyte

Well, for example, you can tie webpack to django:
https://github.com/saintbyte/django_webpack_integration

M
Maxim Lifintsev, 2019-05-31
@Hullabaloooooooo

You can look towards WebAssembly. There is no implementation for python yet (maybe there won't be). But the direction can be interesting.

G
GitCat, 2020-06-13
@GitCat

Can. There is a WebCode library for this, but it does not interact directly with the browser, it only generates html and css. More: https://habr.com/en/sandbox/141376/

L
Leonid, 2021-01-15
@sled

Here is an article about Brython - Python for browsers .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question