Flattened ecookbook.... nothing official... testing some things out...

This commit is contained in:
PySimpleGUI 2022-06-30 15:43:56 -04:00
parent 05fd8ca891
commit 0574702876
109 changed files with 0 additions and 0 deletions

View file

@ -1,27 +0,0 @@
## Mono-Spaced Fonts
Let's start tables using text.
One common problem when working with text and tables is how to get columns to align properly. Most fonts, including the default font, are variable spaced.... each character is a slightly different width than others.
Here's an example using the font used on this webpage. Each of these rows of character are 10 chars long. But, they are clearly different lengths.
1234567890
aaaaaaaaaa
iiiiiiiiii
What to do? Entry our friend the mono-spaced font where each character takes up the exact same width as all the other characters. The most common of these mono-spaced fonts is "Courier". These same rows of characters, when formatted using a Courier font have the same length:
```
1234567890
aaaaaaaaaa
iiiiiiiiii
```
Now let's try this out in a PySimpleGUI program.
This program presents a table in a Multiline element using a default font, which will have variable spaces. As you will initially see, the table is a mess. But, by changing the font of the Multiline to a Courier font, the table become tidy and clear.
<iframe src='https://trinket.io/embed/pygame/192aeae1a7?start=result' width='100%' height='500' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>

View file

@ -1,15 +0,0 @@
A "Mini-Excel" Table
Can be used to:
* Display numeric data
* Use arrow keys to move around the table
* Click on a header to sort table using that column (Column header will be bolded)
On a Windows machine, the window appears like this:
![SNAG-0567.jpg](/api/files/5dd24d93892acde57a9da36d/snag-0567.jpeg)
Clicking on one of the Column Headers (A - F) will cause the entire table to be sorted using that column as the key
<iframe src='https://trinket.io/embed/pygame/8c28a62cec?start=result' width='100%' height='650' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>

View file

@ -1,16 +0,0 @@
"Simulated" Tables - Tables that are constructred using other Elements than the Table Element
In this case it's simply some Text and InputText Elements combined.
Here is what the window looks like on Windows
![SNAG-0566](https://user-images.githubusercontent.com/46163555/68995968-dbc21100-0861-11ea-8d50-dbef4d6ea0fa.jpg)
This is a subset of the larger Table Simulation program that you'll also find on Trinket. This smaller demo shows a table and enables moving around with arrow keys.
The larger demo includes the ability to sort columns. The reason for 2 demos.... make one that's smaller in case that's what you need. It removes the need for you to strip out unwanted code and you can instead begin to add your code to this smaller base of code.
<iframe src='https://trinket.io/embed/pygame/cbb302bd6a?start=result' width='100%' height='600' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>

View file

@ -1,16 +0,0 @@
# Table Element
## Click Events
In relerase 4.48.0 a new parameter was added for all those Table Element fans out there.
The boolean parameter `enable_click_events` in the Table element enables clicks of individual cells and the table headers to be detected and returned to you. This is exactly what's needed if you want to sort your table by columns for example.
This example code can also be found in the Demo Programs section on the PySimpleGUI GitHub at http://demos.PySimpleGUI.org
The Demo Program is named `Demo_Table_Element_Header_or_Cell_Clicks.py`
Here's the demo code ready for you to run. Try clicking on the Column Headers to sort by that column.
500
<iframe src='https://trinket.io/embed/pygame/baca37f8b2?start=result' width='100%' height='500' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>

View file

@ -1,9 +0,0 @@
The Table Element
The `Table` Element is one of the more complex of the elements because there are so many things that are configured when the table is created. In a single line of code everything that is needed to build and display a table including headings, colors, colors, etc, are specified in the parameters passed when creating a `Table`.
This is what the window looks like when run on Windows.
![SNAG-0570.jpg](/api/files/5ddb6944a840008d3051f418/snag-0570.jpeg "SNAG-0570.jpg")
<iframe src='https://trinket.io/embed/pygame/e75349a52f?start=result' width='100%' height='600' frameborder='0' marginwidth='0' marginheight='0' allowfullscreen></iframe>