RetroBASIC

Basicprogramming(.org) => General questions and discussions => Topic started by: ScriptBasic on August 30, 2018, 05:38:38 PM

Title: PySimpleGUI
Post by: ScriptBasic on August 30, 2018, 05:38:38 PM
This should send Aurel over the edge and put a smile on Tomaaz's mug..  :) 

PySimleGUI (https://opensource.com/article/18/8/pysimplegui?sc_cid=70160000001273HAAQ)

Title: Re: PySimpleGUI
Post by: Aurel on August 30, 2018, 10:18:27 PM
He he
nice try....when i see small app icon in left corner
it becomes perfectly clear to me what is this ..
and is it another try to use tk library or tcl/tk layer to create GUI apps on windows with
python...
still there is no real call from python to native windows GUI api functions
why? .. i really don't know
I think that only perl (have a wrapper)can call winapi functions..ruby ..no.

It is really strange why is that so problematic for python (3) developers OR they don't like Windows
after all this years.
In fact it is really shame  that people who work on python in windows must use 3party gui libs .
In python are written many great science programs and poor people must fight with it all the time.
That really sucks!
Imagine...python where you may use windows GDI - hDC directly like we can in many BASICS..

GEEE ...it looks that i like python  :o
well not very much but i appreciate all hard work programers put into scientific programs for sure.
 :)
Title: Re: PySimpleGUI
Post by: Tomaaz on August 31, 2018, 01:36:27 PM
And why would anyone using/creating scientific software care about the technology behind the GUI?
Title: Re: PySimpleGUI
Post by: AlyssonR on September 02, 2018, 08:46:57 AM
Because they want to have an interface of sorts, presumably.
Title: Re: PySimpleGUI
Post by: Cybermonkey on September 02, 2018, 09:08:53 AM
Of course you can access the WinAPI from Python: pywin32 (https://github.com/mhammond/pywin32)
BTW, Mike the creator of PySimpleGUI has just registered, maybe he can say a few words ...  ;)
Title: Re: PySimpleGUI
Post by: Tomaaz on September 02, 2018, 09:57:35 AM
Because they want to have an interface of sorts, presumably.

And is it that important for scientific software to have GUI written using WinApi and not Tk, IUP or Swing? I would think it's the least important thing. Speed, stability, accuracy, being bug-free... Aurel is just projecting his obsessions on others. The whole GUI/WinApi thing has been his fetish for years. For him, as long as WinApi is used, a program that has one button and can draw a circle when the button is pressed is more advanced than a complex command line tool,
Title: Re: PySimpleGUI
Post by: Aurel on September 02, 2018, 11:25:42 AM
As usual Tomek like to talk about things he cannot swallow or he is not capable to undrstand .
Windows message loop and qeue is like a nightmare for him.
That is the fact.
He don't understnd hardware conception... ::)
Hw don't know how windows can operate in rwo mods 32/64 and he is not  the only one.
I don't know who is this Mike guy   :o
And what he made but the fact is python is not developed for windows.
...and as such is limited in many windows only things
For example in py2-or py3 i don't see layerr to winapi---is that enough.
all other specualtionss are just crap.
Title: Re: PySimpleGUI
Post by: Tomaaz on September 02, 2018, 01:04:21 PM
Yes Aurel, scientists who use computers for work definitely care about "Windows message loop and qeue...", understand "hardware conception" and know "how windows can operate in rwo mods 32/64". They are also very disappointed that Aurel Basic is not in development anymore, because they really hoped that one day it could replace this crappy Python, its crappy GUI libraries and software written in it.  Sure...

I don't know who is this Mike guy   :o

That must be really devastating for him. The legendary Gui/WinApi programmer and hardware genius Aurel doesn't know him. I hope he's not thinking about harming himself!  ;D ;D ;D
Title: Re: PySimpleGUI
Post by: Aurel on September 02, 2018, 03:49:25 PM
Quote
Yes Aurel, scientists who use computers for work definitely care about "Windows message loop and qeue..."
First of all
scientists who use computers for work - i really doubt that they use python  ;D ;D ;D
second - you are not scientists  :o
3. - I don't talk about scientists than about YOU!  ::)
--so don't be horny and put the pipe down  ;D

..and put the things back on topic
PySimpleGUI is just another try to ...
ahh to boring...................

AND who care about python...cra*
maybe we should talk about... let say - JavaScript ?
Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 02, 2018, 04:04:31 PM
I'm curious what about the OpenSource article caught John's eye enough that he posted about it here.

I registered because you guys are some of the first Python programmers that have posted on their own, without my prodding.

Truth is that I do not have some deep background in GUIs.  I needed to create several Python programs with a GUI front end.  When I looked at Python's GUIs, I found them to be way too 'wordy' for my liking.  I determined I could write and use a GUI framework in less lines of code than if I wrote tkinter code for my programs.  And that's what I ended up doing.

The more I used it, the more I realized others could benefit, so out to the world it went.  I don't seek fame, that's for sure, and would just as soon remain anonymous.  I believe in this architecture's ability to bring GUIs to a large number of Python programs should they want it. 

There have been a good number of features added over the past month that were suggested by users and people reviewing the package.  Dictionary return values is one of the big ones.  As a result, I'm interested in hearing from others.  It only makes for a better package in the long run, assuming I can duck the rocks hurled my way on occasion.


Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 02, 2018, 04:15:47 PM
I can't help but notice the talk about scientific applications.

The science-types may be interested in the Matplotlib Browser Demo.

This app demonstrates integrating PySimpleGUI with Matplotlib.  It also shows off some of the interesting features of PSG, in this case immediate action when a listbox item is clicked.


(https://user-images.githubusercontent.com/13696193/44958131-8fcbbc00-aea9-11e8-8396-d66e483e7ce5.jpg)
Title: Re: PySimpleGUI
Post by: Tomaaz on September 02, 2018, 05:32:52 PM
I will be trying your GUI soon. And please, ignore Aurel. He's a hard core Python/Linux hater. From his statement about Python usage in science you can clearly see that he doesn't have a clue. I hope you will stay here and will be posting updates about your project. This place is not about games only anymore.
Title: Re: PySimpleGUI
Post by: ScriptBasic on September 02, 2018, 05:49:57 PM
Actually the post here was initiated from a Twitter post and I thought it might be a club for Tomaaz to beat up Aurel with.

Welcome!

You may be interested in what I have going using VB6 OCX GUI forms as an object based UI framework.

https://AllBASIC.info/forum
Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 02, 2018, 05:59:17 PM
Thank you for the warm welcome! 

I know this package isn't for everyone and it's not meant to try to solve every GUI problem. 

I'm trying to stay focused on solving problems that users throw my way so that the features stay ahead of typical use cases. This is done through the many "Demo" applications and Cookbook entries.  Making a script launcher, for example, caused a few extra features to be created.  The Matplotlib Browser program drove the creation of immediate response to Listbox entry selection.

Besides, it's fun to try and meet the challenges.  Sometimes it takes only 4 or 5 lines of code.

The package has already extended well beyond the initial target. 

Marketing....

Can I ask for help in marketing PySimpleGUI?  I'm learning that in order to get feedback that I can use I first need users.  That means getting the word out the this package even exists.  I'm getting close to having my Wikipedia page done which should help.

The help I need is in getting another 8 votes on one of the most popular curated list of Python resources available.  If I can get 20 votes, I get listed.  I'm up to 12 so far.

You'll find the instruction on how to vote here:
https://github.com/MikeTheWatchGuy/PySimpleGUI/issues/80

It's really easy assuming you have a GitHub account.

I'll be looking at your object based UI framework for sure! 

Title: Re: PySimpleGUI
Post by: Aurel on September 02, 2018, 10:03:58 PM
Quote
And please, ignore Aurel. He's a hard core Python/Linux hater.
- No i am not and you can ignore me ,that is not a problem at all..  :D

Quote
From his statement about Python usage in science you can clearly see that he doesn't have a clue.

-..and you have a clue, of course you really believe that if you use
someone else code and change few variables makes you a programmer.   ;D

It would be great that we have here real python programmer
and not just copy/paste lurker like is Tomaaz.

So back to topic
Welcome to forum !
Title: Re: PySimpleGUI
Post by: Tomaaz on September 02, 2018, 10:54:42 PM
I think we are approaching the moment when Aurel plays "the vodka card"...
Title: Re: PySimpleGUI
Post by: ScriptBasic on September 02, 2018, 11:03:54 PM
With you it's vodka with me it's the pipe.
Title: Re: PySimpleGUI
Post by: Tomaaz on September 03, 2018, 12:15:17 AM
Before that, he will try to side with one of us, against the other. Sometimes it's me, sometimes it's you. And then, finally, he'll play the vodka and pipe cards. Some things never change.  ;)
Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 03, 2018, 12:25:57 AM
One use for PySimpleGUI that you guys may like is in controlling command line programs.  I'm lazy.

I have been using a utility named youtube-dl to download subtitles from YouTube videos. It's a command line utility that looks something like this:

youtube-dl.exe --sub-lang en --write-sub https://www.youtube.com/watch?v=8KkKuTCFvzI

There's an option to list the available languages.  Since I've been using it a lot, I made this front end. 

https://user-images.githubusercontent.com/13696193/44962378-3b4a3000-aeed-11e8-8edd-c2e01007c312.jpg

Paste the link into the top of the window and can then list the available languages & download languages.   

Able to do multiple operations by leaving the window open and interacting with it much like a windows program. 

If more options desired, they can easily be added them in the user interface.
Title: Re: PySimpleGUI
Post by: ZXDunny on September 03, 2018, 10:09:03 AM
With you it's vodka with me it's the pipe.

I have trouble picturing John with a hash pipe.
Title: Re: PySimpleGUI
Post by: ScriptBasic on September 03, 2018, 03:56:54 PM
The pipe story came about when I told Aurel to "put down the pipe" in a post and it's now his retribution response towards me going forward.
Title: Re: PySimpleGUI
Post by: ZXDunny on September 03, 2018, 05:48:27 PM
The pipe story came about when I told Aurel to "put down the pipe" in a post and it's now his retribution response towards me going forward.

I had no idea you smoked weed. Still, it's gaining a better reputation these days and appears to be healthier than alcohol, all things considered. Bravo to you for being so forward thinking!
Title: Re: PySimpleGUI
Post by: Mike Lobanovsky on September 03, 2018, 06:26:31 PM
(https://i.pinimg.com/originals/da/c0/d7/dac0d7007b1be2d7021adb592fa9b299.png)
Title: Re: PySimpleGUI
Post by: Tomaaz on September 03, 2018, 06:55:42 PM
Guys, you like to call me and Aurel trolls and spammers, but the way you killed this topic is a top class.  ;D
Title: Re: PySimpleGUI
Post by: ZXDunny on September 03, 2018, 07:00:56 PM
Guys, you like to call me and Aurel trolls and spammers, but the way you killed this topic is a top class.  ;D

The whole topic was started as an attempt to troll, so no harm done.
Title: Re: PySimpleGUI
Post by: Tomaaz on September 03, 2018, 07:09:08 PM
The whole topic was started as an attempt to troll, so no harm done.

Have you missed the fact that the author of this GUI has joined the discussion. I'm sure he would like his job to be taken seriously. You really shouldn't have continued this nonsense after his last post.
Title: Re: PySimpleGUI
Post by: ZXDunny on September 03, 2018, 09:35:29 PM
I don't think that really makes any difference? If we were all worried about certain people joining a discussion (especially as this thread was not meant to be a discussion of PySimpleGUI, but was more a nasty dig) then we'd likely not start any more of them.

Actually, that would be preferable. As you were :)
Title: Re: PySimpleGUI
Post by: ScriptBasic on September 04, 2018, 12:52:01 AM
It's the admin's chore to clean up threads that go off topic.
Title: Re: PySimpleGUI
Post by: B+ on September 04, 2018, 02:19:24 PM
I am thinking there are enough Py forums already and wondering if PySimpleGUI is really BestOf... with another one of his name changes.  ;)

No, then it would be "easyaspygui"
Title: Re: PySimpleGUI
Post by: Cybermonkey on September 04, 2018, 03:48:59 PM
One use for PySimpleGUI that you guys may like is in controlling command line programs.  I'm lazy.

I have been using a utility named youtube-dl to download subtitles from YouTube videos. It's a command line utility that looks something like this:

youtube-dl.exe --sub-lang en --write-sub https://www.youtube.com/watch?v=8KkKuTCFvzI

There's an option to list the available languages.  Since I've been using it a lot, I made this front end. 

https://user-images.githubusercontent.com/13696193/44962378-3b4a3000-aeed-11e8-8edd-c2e01007c312.jpg

Paste the link into the top of the window and can then list the available languages & download languages.   

Able to do multiple operations by leaving the window open and interacting with it much like a windows program. 

If more options desired, they can easily be added them in the user interface.
Funny thing is, I am using youtube-dl on my RPi and using a GUI for entering the URL of the video. But I am not using Python but a bash script with Zenity.  ;)
Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 04, 2018, 08:01:38 PM
I am thinking there are enough Py forums already and wondering if PySimpleGUI is really BestOf... with another one of his name changes.  ;)

No, then it would be "easyaspygui"

Had EasyGUI had enough feature for my project, PySimpleGUI wouldn't exist.  I took a look at all of the GUI options I could and determined there was a gap.  I couldn't find anything that would allow you to create pretty much any GUI you can draw on a piece of paper.

So, yea, it's the best of, but then some.

The way you interface with PySimpleGUI was built from the ground up, not borrowed from anything that I saw.  I came at the problem from a pure Python outlook. What's the Pythonic way of representing data, getting return values?  I tried to keep Python in the forefront of the design.

I'm not knocking the prior work people did.  A lot of people spent a lot of time creating software that they gave away.  It's really hard to knock those kinds of efforts and not look like a dick.


Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 04, 2018, 08:29:43 PM

Funny thing is, I am using youtube-dl on my RPi and using a GUI for entering the URL of the video. But I am not using Python but a bash script with Zenity.  ;)

I have not heard of Zenity before. 
I really like their interface.

I just went through a renaming exercise for all of my "Message Boxes".  The names Zenity used are great!

Code: [Select]
A Zenity infobox as displayed on GNOME 3 (Please press a button).png
from PyZenity import InfoMessage
from PyZenity import Question
from PyZenity import ErrorMessage

choice=Question('Please press a button.')

if choice:
     InfoMessage('You pressed Yes!')
else:
     ErrorMessage('You pressed No!')


I'm liking the Question name in particular. 

One target group for PySimpleGUI are beginners that don't know computer stuff at all.  My previous function name for Popup was MsgBox.  MsgBox is easy to get for programmer types, but it's not obvious to non-programmers.  I think almost everyone that's used the internet can tell you what a Popup is.

I've clearly got something to learn from these folks.

If you like putting GUIs onto the front end of your programs, think about using PySimpleGUI for your next one.  You can copy the demo program for launching scripts and get a headstart.   Just shout if you want to give it a try and I'll give you a hand.
Title: Re: PySimpleGUI
Post by: Aurel on September 05, 2018, 07:14:09 AM
PopUp
?
It is a MessageBox which is type of dialog window in winApi GUI programming.
PopUp is a type of window.
Well i never tried when i used python to load mydll.dll import in app
let say dll created with Oxygen basic or Free basic  or C
is that possible...
If is then you can create GUI functions in this compilers and add it to python program?
Title: Re: PySimpleGUI
Post by: Tomaaz on September 05, 2018, 05:42:40 PM
I am thinking there are enough Py forums already and wondering if PySimpleGUI is really BestOf... with another one of his name changes.  ;)

No, then it would be "easyaspygui"

You should try to use Easygui, PySimpleGUI and Tkinter directly. You will clearly see that they are quite different. Also, Easygui's been abandoned.
Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 06, 2018, 07:57:13 PM
I've been dumping in features on a daily basis.

Just released version 2.30 to PyPI.

It includes borderless windows (i.e. have no titlebar). They're pretty slick looking.  Really clean looking interfaces are possible now.

(https://user-images.githubusercontent.com/13696193/45168664-d848e980-b1c9-11e8-886e-63279ae4017f.jpg)

Here's another program that I run a LOT.  It queries Stack Overflow using a program called How Do I.  If you ever visit stack overflow, this it the program for you!

(https://user-images.githubusercontent.com/13696193/45181703-2de2bd80-b1ed-11e8-9fe8-91ed92bcb873.jpg)

I've been doing quite a bit with the docs too. Making lots of Recipes for the Cookbook and have 46 demo programs that can be downloaded.

Maybe the password login one is of interest?  It was fun because it contains a GUI to create your SHA1 hash code that you paste into your code for comparison.  The code you drop into the program that you want the password entry on is relatively small at about 15 total lines of code.

https://github.com/MikeTheWatchGuy/PySimpleGUI/blob/master/Demo_Password_Login.py

Trying to try prototype as many different kinds of scenarios as possible.  It ends up pushing the feature set.  Recently added a Calendar chooser that looks really nice.

Part of why I'm out talking to people that at least have a chance of trying it out is to find the kinds of problems they want to solve.  Sometimes that leads to new stuff.

Do any of you have kids that are into programming?

One goal is to get kids thinking about computers using modern interfaces rather than the command line.  Not knocking command line for people that like it or need to use pipes.  Those aren't my peeps.  It's the person that's interested in getting something working that looks good that I'm interested in reaching.  Why not teach them that you can get input from a window and output to one just as easily as you can the command line?

Title: Re: PySimpleGUI
Post by: Aurel on September 06, 2018, 09:36:14 PM
Quote
Why not teach them that you can get input from a window and output to one just as easily as you can the command line

Well this can be done in many BASIC dialect which support GUI programming
and most of them do that very well ...but i think that you know that ..right?
Did you ever made programs in any BASIC dialect or you use python only?
I just asking..
Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 07, 2018, 12:51:07 AM
Well this can be done in many BASIC dialect which support GUI programming
and most of them do that very well ...but i think that you know that ..right?
Did you ever made programs in any BASIC dialect or you use python only?
I just asking..

I haven't programmed using a modern BASIC dialect.  The last time I programmed in basic was 1979.  Just sayin.  ;)

Sounds like there are things Python can learn from BASIC.  Or I can.

GUIs shouldn't be hard.  Beginners should be able to write their own software that they use if they want.  Maybe you've written a file copy utility as an exercise and want to use it as part of your daily routing use on a computer.  Could be just me that liked that kind of stuff when I was learning. 

Are there particular features you use from YouTube-dl?  I got it to grab subtitles so that's all my GUI does at the moment, build and present a list of subtitles that can be downloaded.



Title: Re: PySimpleGUI
Post by: Cybermonkey on September 07, 2018, 03:47:59 PM

Are there particular features you use from YouTube-dl?  I got it to grab subtitles so that's all my GUI does at the moment, build and present a list of subtitles that can be downloaded.

Just for watching youtube videos on my Raspberry Pi. I enter the URL of the video and then it is played via the omxplayer which has a better performance than using any webbrowser.
Hm, I really should have a deeper look into Python I guess ... it's the preferred programming language for the RPi. (Although I am a big fan of Lua)
According to your post, that you programmed the last time in BASIC in 1979, you are also not the youngest I guess.  ;) I started in 1984 programming in BASIC with the Commodore 64.
Title: Re: PySimpleGUI
Post by: Cybermonkey on September 08, 2018, 09:32:52 PM
The script is nothing more than this:

Code: [Select]
inputStr=$(zenity --entry --title="Play Youtube video" --text="Enter URL")
omxplayer -o local `youtube-dl -g -f best $inputStr`
Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 11, 2018, 02:58:13 AM
The script is nothing more than this:

Code: [Select]
inputStr=$(zenity --entry --title="Play Youtube video" --text="Enter URL")
omxplayer -o local `youtube-dl -g -f best $inputStr`

Yea, but it can sometimes take weeks to find the exact string you needed to get whatever it is done you wanted.  The mighty string!
Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 17, 2018, 06:03:12 PM
I created a retro-game using PySimpleGUI.   PONG

I'm slowly working my way toward being appealing to the youthful beginner.  Often games are a desired project.

Pong using PySimpleGUI (https://github.com/MikeTheWatchGuy/PySimpleGUI/blob/master/Demo_Pong.py)

I didn't write the pong code, but I did integrate it into a GUI so buttons, etc can be added.

A number of people have posted in the past complaining that there is no GUI in PyGame.  I would like to integrate with PyGame too so that a GUI solutions exists for those people wanting one.

Title: Re: PySimpleGUI
Post by: PySimpleGUI on September 21, 2018, 04:14:30 AM
(https://user-images.githubusercontent.com/13696193/45860012-2d8d0b00-bd33-11e8-9efd-3eaf4c30f324.gif)