Jump to content

Python3 GUI system?


larryllix

Recommended Posts

I have been trying to crack the GUI world using python3.

 

I have been experimenting with tkinter, in various incarnations, and now Django, but I have been finding the documentation with these packages are terrible, very confusing, and mostly non-fuctional, perhaps being dependant on different setups not disclosed by the tutorials. Even the hundreds of dollars in python books give tutorials that just don't load or end up with Entry boxes floating unpredictably on a form.

 

Is there any better packages to present forms before doing many more weeks of exploration, only to find the same thing again and again?

 

Any input advice appreciated.

 

Thanks in advance.

Link to comment

What is this for? Talking to ISY, or something else?

 

Well, tkinter and Django certainly are wildly different approaches.

 

tkinter works on top of a traditional Linux-based desktop UI toolkit, while Django is an MVC framework for creating web back ends.

 

If you MUST Python, I would go with the latter, as you then have a wide choice of modern, up-to-date UI widget libraries, styling with CSS, etc. You would be using Python only for back-end functions like accessing  a database, talking to ISY with REST or UDAjax, etc. And you would *probably* be using some back-end templating system.

 

Nothing against Python - I've used it, but not recently. I prefer Ruby, which I realize is not as popular. I like node.js as well, but it is not as mature.

 

I don't know if I would use Ruby on Rails today, but probably something more pared-down like Sinatra. There are a whole *world* of Gems (packaged libraries) to choose from! And you have a HUGE variety of templating engines to choose from, and courtesy of Tilt, you can even mix and match them IN THE SAME FILE.

 

So, while I am not a fan of ERB, I love the elegance of Slim for writing widget markup, and the ease of using markdown for text content.

 

Documentation for Ruby components tends to be excellent.

 

I would tend to stick to the front-end CSS/Javascript UI libraries for things like lists, forms, tables, other widgets. I'm working with Bootstrap 4 right now, (in alpha, but good enough to use in a project) it is a rewrite of Bootstrap with metrics expressed in rem rather than pixels (so easy to make scalable UIs!) and deep support for flex-box layout. (So easy to make work well on different sized windows.)

 

I am NOT a fan of MVCs stuffed into Javascript, like Angular. They have a LONG learning curve and are insanely complex, and stuff too much functionality into the browser that belongs elsewhere.

 

Pretty much any current router or IOT appliance that has a web interface, you are looking at Bootstrap 3 for UI. Yes, it is plain-jane and they all look the same, but you CAN dress it up. But don't start now with 3, go with 4.

 

Then pick a template language or two to plug into your Python or Ruby or node.js backend, and build your repetitive UI elements from TINY templates (I try not to exceed a few lines each!) Style with Sass. You can then quickly change APPEARANCE by changing CSS (Sass) and STRUCTURE (do I use a table, or a list, or...) by modifying your templates.

 

If this doesn't make a whole lot of sense at first, do a bit of poking-around:

 

https://v4-alpha.getbootstrap.com/

 

http://www.sinatrarb.com/

 

https://github.com/rtomayko/tilt

 

http://slim-lang.com/

 

http://sass-lang.com/

 

Yes, it's a whole bunch of pieces/parts that you have to plug together. I like being able to pick the pieces myself.

Link to comment

What is this for? Talking to ISY, or something else?

 

Well, tkinter and Django certainly are wildly different approaches.

 

tkinter works on top of a traditional Linux-based desktop UI toolkit, while Django is an MVC framework for creating web back ends.

 

If you MUST Python, I would go with the latter, as you then have a wide choice of modern, up-to-date UI widget libraries, styling with CSS, etc. You would be using Python only for back-end functions like accessing  a database, talking to ISY with REST or UDAjax, etc. And you would *probably* be using some back-end templating system.

 

Nothing against Python - I've used it, but not recently. I prefer Ruby, which I realize is not as popular. I like node.js as well, but it is not as mature.

 

 

 

Thanks jtara!

Not really fluent in much of this but a few things to look into there,

 

I was hoping to use something more native to python3 and tkinter looks like it would be the one,.

After a week of digging I find it is really not developed into a useful tool, as far as I can dig. :(

After discovering a few more nail down techniques for entry boxes to stop them floating around as badly, I started digging into some data techniques and ran into. Linking the data in the widgets with a variable isn't really implmemented..grrrr.... and the work around given doesn't even work from the python versions own help files.

...further grrrrrr.....

 

OTOH as a positive thing python does through an error saying it is not supported contrary to the rest of tkinter that throws no errors at all, making a lot of guessing for days and days to make each method work....

.....extreme grrrrrrr...

 

I am trying to port some old VB 1.0 code my father wrote to handle genealogy databases over to python3 but I am finding VB 6. is still way out front  for GUI handling. Of course silly. You are working on a GUI system as opposed to a 1980's MsDos style command line OS. What did I expect? :( :(

 

This code and database came off of floppies which I had to fire up and old Win 2000 system to even load. Saving made the code loadable into VB 3.0 and saving again made it loadable into VB 6.0 which, with some shell fakery can run be run on Win 7 and Win 10.

 

The database was packed ASCII and I have now written a converter in python to port that to a CSV file making it more useable...hopefully.

 

Yeah, I know about GEDcom and so many genealogy apps but over the years we proved they could not handle all the family twists and turns and GEDCOM has been extended by so many unco-operative apps that there is not standard that works across the board. 

 

As an aside (interesting humour). We have found in our family back in the 1500-1600s that a parent would want a son named "John" and when each of the five of them died at age 1-2 years, you just name the next one "John" because you liked the name. Nice database twist! LOL Then there is multiple wives with the same names and since you liked the name John, each wife  had one named "John" too. LOL

 

But that is OK  because none of them could read or write so the local preacher had to guess at spelling when they died for the records. Some had 4 and 5 spellings documented for the name, just to make sure, one was correct. Wow!

Link to comment

I had another go with tkinter and got a little further but what a mess of syntax gobble-dee-gook with combinations of script style code inside method calls. This is in addition to usual confused python help documets and forums that all disagree.. Yuk.

 

However, I found another GUI wrapper, pyQT5,  that appears to use more standard python/VB looking methods and function calls. Many big packages have been written using it and it has a longer history, even with company forks into pySide, that is trying to reunite for the goodness of the sport. pyQT5 is not natively included with python3.4.5 but it seems to be worth it, according to wkipedia and other articles. Tooted to be fully supported on every OS  have seen making noise  in the last ten years.

 

 

OK...I'm going in!   ...while  I still have some hair and medication left. :)

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...