Web Analytics Made Easy - Statcounter
Skip to content

The Demo Browser

There are so many demo programs that a way of quickly searching them was needed. There is the "Demo Programs Browser" that makes finding, editing and running Demo Programs easier.

Demo Program & Project Browser Features

The "PySimpleGUI Demo Program & Project Browser" makes searching for and searching inside of the PySimpleGUI Demo Programs easier. You can also use this program with any folder of Python programs. They don't have to be PySimpleGUI programs or PySimpleGUI related.

Some of the features this program provides are: * Displays your project tree as a single list of files * "Filtering" of the files - searches by filename * "Find" files - searches inside of your list of files * Opening files using the editor of your choice * Executing the files * Easy editing of the Browser Program itself using the "Edit Me" button

Downloading the PySimpleGUI Demo Programs

Jump Start! Get the Demo Programs & Demo Browser

The over 300 Demo Programs will give you a jump-start and provide many design patterns for you to learn how to use PySimpleGUI and how to integrate PySimpleGUI with other packages. By far the best way to experience these demos is using the Demo Browser. This tool enables you to search, edit and run the Demo Programs.

To get them installed quickly along with the Demo Browser, use pip to install psgdemos:

python -m pip install psgdemos

or if you're in Linux, Mac, etc, that uses python3 instead of python to launch Python:

python3 -m pip install psgdemos

Once installed, launch the demo browser by typing psgdemos from the command line"

psgdemos

SNAG-1543

Download the Repo and Demos

If you chose not to pip install the psgdemos package, then you can download the PySimpleGUI Repo from GitHub and run the Demo Browser.

Follow these instructions to download the repo and demos:

  • Go to http://www.PySimpleGUI.com (the PySimpleGUI GitHub)
  • Download the repo as a ZIP file download
  • Unzip the downloaded zip and place the folder DemoPrograms somewhere on your local disk drive that you have write access

Setup the Demo Browser

Once you've got your Demo Programs folder set up on your local computer:

  • Run the program Browser_START_HERE_Demo_Programs_Browser.py that is in the folder you unzipped

When you first run the Demo Browser, it will probably look something like this:

download

To change the settings:

  • Click the "Settings" button

Click the "Settings" button. You'll see a window like this one:

download

I've changed the theme to be "DarkGrey13" and checked "Use Advanced Interface". I know a number of users like "Dark Themes" so let's use a "dark grey 13" theme for this recipe and enable the advanced features.

After clicking OK the window changes to:

download

More Details on Settings

  • Fill in the input fields labelled Path to Demos and Editor Program
  • Path to Demos - Defaults to the location of the Demo when you run it the first time. You can leave unchanged if this program is going to remain with the other demos. Use an absolute path.
  • Editor Program - If you want to be able to use the "Edit" button in this browser to open and edit the demo programs, then fill in the name of the .EXE (for windows) of your editor/IDE. If you have set up an editor in the global settings for PySimpleGUI, then you don't need to set up an editor in the browser demo.
    • PyCharm
      • Windows - it's not an EXE but a batch file. It will look something like this: C:\Program Files\JetBrains\PyCharm Community Edition 2020.3\bin\pycharm.bat
      • Linux - it's a bit trickier. It may resemble something like this: /home/mike/.local/share/JetBrains/Toolbox/apps/PyCharm-C/ch-0/202.8194.15/bin/pycharm.sh
      • Mac - I dunno yet.... there's an open Issue on GitHub asking for help from Mac user
    • Notepad++
      • Windows - Something along the lines of C:\Program Files\NotePad++\notepad++.exe
    • Notepad
      • Windows - c:\windows\notepad
      • Linux - /usr/bin/notepad
    • Custom
      • Assuming your editor is invoked using "editor filename" when you can use any editor you wish by filling in the "Editor Program" field with a path to the editor executable

NOTE - if you want to be able to use the Edit button to open to a specific line number, then you will need to setup the editor in the PySimpleGUI Global Settings. You can access the PySimpleGUI Global Settings from Home Window by calling sg.main(). There is a button labelled "Global Settings". There is already a lot of duplication of settings happening between this browser and the PySimpleGUI global settings. Once you've got the global settings made, then you don't need to make any chnages to the seettings in the browser program. You can leave them all blank and the settings will come from the PySimpleGUI global settings.

Window Sections

These are some of the important part of the window that are not as obvious as other parts.

download

Verbose Mode

Verbose mode will show you the full matching line from the file. This is handy for when you're looking for a specific way something is used.

By default the Verbose mode is turned off. This is because search results are updated in realtime as you type characters. If your project tree is large then your verbose output will be very very large as you type the first few characters of your search.

The best way to use the Verbose feature is to perform the search with it turned off. Once you get the list of files from your search, then click verbose to see the more detailed view of the results.

In this example, I've searched for the demos that use the Graph element. Searching for "sg.Image(" will return the demos that make this element.

download

If I then uncheck the "Show onlyu first match in file" then I can see when multiple matches are found in a file.

download

In verbose mode and all matches are shown, when a file is selected from the list and the "Edit" button is clicked, then another window will show you the list of lines that matched and allows you to click on the line to be taken to. Selecting a line will open your editor to that line.

download

NOTE - this feature is 99% complete! The lines shwon in the "Open Editor" window don't yet show the code that is contained on each of those lines. Comoing VERY SOON!

"Open Folder" feature

If you have an explorer program specified in the settings or in the PySimpleGUI Global Settings, then choosing a file and clocking the "Open Folder" button will launch the file browser that you've specified and open the folder that the file is contained in.