Flattened ecookbook.... nothing official... testing some things out...
This commit is contained in:
parent
05fd8ca891
commit
0574702876
109 changed files with 0 additions and 0 deletions
|
@ -1,16 +0,0 @@
|
|||
Changing your buttons from plain rectangular GUI buttons to graphic images is very easy in PySimpleGUI.
|
||||
|
||||
Button graphics are specified when creating the Button, inside of your layout.
|
||||
|
||||
This is what the code below looks like running on Windows.
|
||||
|
||||

|
||||
|
||||
|
||||
<iframe src='https://trinket.io/embed/pygame/a3dcdfc221?start=result' width='100%' height='500' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>
|
||||
|
||||
This particular button graphic is larger than it needs to be. It should have been edited prior to use in the program. The size of the button as specified in the code is huge in comparison to the screenshot above. Removing the `image_subsamble=8` from the Button creation you'll see the full size of the button graphic.
|
||||
|
||||
By the way, the `image_subsample` value indicated how much to "divide" the size by. The value of "8" specified above means to use 1/8 the size of the original. If the value was "2" then 1/2 of the original size will be shown.
|
||||
|
||||

|
|
@ -1,33 +0,0 @@
|
|||
A "Color Picker" or "Color Chooser"
|
||||
|
||||
These selection windows are usually provided by the GUI framework. But let's say you wanted to replace the normal system one. One way to do it is using a grid of colored buttons.
|
||||
|
||||
This code demonstrates:
|
||||
* Use of ttk buttons - they have beter highlighting then normal tk buttons
|
||||
* Setting border=0, padding=(0,0) and no_titlebar - makes a very minimal look
|
||||
* `Buttons`, like `Text`, do not need a text parameter filled in. It defaults to `''`
|
||||
|
||||
Here is how the window looks running on Windows
|
||||
|
||||

|
||||
|
||||
Setting the button size to (None, None) results in an extremely compact version
|
||||
|
||||

|
||||
|
||||
A Qt version was easy to make. It required changing the import to `PySimpleGUIQt` and couple of tweaks to parameters. With the Qt version it's possible to specify Button sizes in pixels so it's possible to get the specific size you're seeking. In this case 20x20 pixel squares w3ere used.
|
||||
|
||||

|
||||
|
||||
The same code even works on PySimpleGUIWeb
|
||||
|
||||

|
||||
|
||||
And finally, the red-headed step-child port PySimpleGUIWx has no problem displying the window
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
|
||||
<iframe src='https://trinket.io/embed/pygame/aefc26ee3e?start=result' width='100%' height='500' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>
|
|
@ -1,15 +0,0 @@
|
|||
Show a "Notification Window"
|
||||
|
||||
This is a very clever bit of code that was submitted by a PySimpleGUI user. It shows a "toaster" style of window (doesn't slide up/down but instead fades in/out). You can click on the notification window and it will immediately dismiss it.
|
||||
|
||||
The fade-in/fade-out effects are not visible on Trinket but are if you download the code and run on your computer.
|
||||
|
||||
This program demonstrates:
|
||||
* Computing screensize for placement of window
|
||||
* Using a no_titlebar setting to create a clean window that doesn't look like a "normal window"
|
||||
* Alpha channel used to fade window in and out
|
||||
* Embeds icons into the code itself thus removing the need for multiple files. Makes it possible to copy and paste the program into your code to add the feature.
|
||||
* Use of `Element.Widget` member variable to extend the PySimpleGUI feature set by directly accessing a tkinter setting. Used to create the "hand" cursor when mouse is over window
|
||||
* Using a single Graph Element to draw an entire window, placing graphics and text in a very precise manner. The entire window is a single Graph Element
|
||||
|
||||
<iframe src='https://trinket.io/embed/pygame/8c79640020?start=result' width='100%' height='600' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>
|
Loading…
Add table
Add a link
Reference in a new issue