New readme_creator release - some pretty big changes overall
This commit is contained in:
parent
3441c740a4
commit
0ae9f88396
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"README_FILENAME": "output/readme.md",
|
||||
"CALL_REFERENCE_FILENAME": "output/call reference.md"
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,8 +1,11 @@
|
|||
from inspect import getmembers, isfunction, isclass, getsource, signature, _empty, isdatadescriptor
|
||||
from datetime import datetime
|
||||
import PySimpleGUIlib, click, textwrap, logging, json, re, os
|
||||
import click, textwrap, logging, json, re, os
|
||||
import os
|
||||
cd = CD = os.path.dirname(os.path.abspath(__file__))
|
||||
import PySimpleGUI as sg
|
||||
|
||||
module_to_process = sg
|
||||
|
||||
from collections import namedtuple
|
||||
triplet = namedtuple('triplet', 'name value atype'.split(' '))
|
||||
|
@ -351,9 +354,10 @@ def get_sig_table_parts(function_obj, function_name, doc_string,
|
|||
rows.append(f'| {atype} | **RETURN** | {text}')
|
||||
except Exception as e:
|
||||
padded_name = "{: <25}".format(f"'{a_original_obj.__name__}'")
|
||||
# TODO - Mike changed this!
|
||||
# logger.warning(f"ALERT ------ Hi, Mike! Please, fix ':return:' in {padded_name}"
|
||||
# " \tIF you want to see 'return' row in 'signature table'")
|
||||
|
||||
logger.warning(f"ALERT ------ Hi, Mike! Please, fix ':return:' in {padded_name}"
|
||||
" \tIF you want to see 'return' row in 'signature table'")
|
||||
# import pdb; pdb.set_trace();
|
||||
|
||||
header = '\nParameter Descriptions:\n\n|Type|Name|Meaning|\n|--|--|--|\n'
|
||||
|
@ -432,6 +436,7 @@ def main(do_full_readme=False,
|
|||
insert_md_section_for__class_methods:bool=True,
|
||||
remove_repeated_sections_classmethods:bool=False,
|
||||
output_repeated_tags:bool=False,
|
||||
main_md_file='markdown input files/2_readme.md',
|
||||
skip_dunder_method:bool=True):
|
||||
"""
|
||||
Goal is:
|
||||
|
@ -462,7 +467,7 @@ def main(do_full_readme=False,
|
|||
# =========== 1 loading files =========== #
|
||||
# =========== 2 GET classes, funcions, varialbe a.k.a. memes =========== #
|
||||
# 8888888888888888888888888888888888888888888888888888888888888888888888888
|
||||
readme = readfile('2_readme.md')
|
||||
readme = readfile(main_md_file)
|
||||
|
||||
def valid_field(pair):
|
||||
bad_fields = 'LOOK_AND_FEEL_TABLE copyright __builtins__ icon'.split(' ')
|
||||
|
@ -478,7 +483,7 @@ def main(do_full_readme=False,
|
|||
return True
|
||||
|
||||
|
||||
psg_members = [i for i in getmembers(PySimpleGUIlib) if valid_field(i)] # variables, functions, classes
|
||||
psg_members = [i for i in getmembers(module_to_process) if valid_field(i)] # variables, functions, classes
|
||||
# psg_members = getmembers(PySimpleGUIlib) # variables, functions, classes
|
||||
psg_funcs = [o for o in psg_members if isfunction(o[1])] # only functions
|
||||
psg_classes = [o for o in psg_members if isclass(o[1])] # only classes
|
||||
|
@ -622,7 +627,7 @@ def main(do_full_readme=False,
|
|||
continue
|
||||
except Exception as e:
|
||||
if logger:
|
||||
logger.error(f'Error in finding the METHOD: {str(e)}')
|
||||
logger.error(f' General error in parsing class_method tag: tag = "{tag}"; error="{str(e)}"')
|
||||
continue
|
||||
|
||||
# {{{{{{{{{ collect }}}}}}}}}
|
||||
|
@ -697,17 +702,22 @@ def main(do_full_readme=False,
|
|||
|
||||
logger.info(good_message)
|
||||
logger.info(bad_message)
|
||||
|
||||
bad_part = '''\n\nParameter Descriptions:\n\n|Type|Name|Meaning|\n|--|--|--|\n\n'''
|
||||
readme = readme.replace(bad_part, '\n')
|
||||
|
||||
|
||||
# 8888888888888888888888888888888888
|
||||
# =========== 6 join =========== #
|
||||
# 8888888888888888888888888888888888
|
||||
|
||||
|
||||
|
||||
files = []
|
||||
if 0 in files_to_include: files.append(readfile('1_HEADER_top_part.md'))
|
||||
if 0 in files_to_include: files.append(readfile('markdown input files/1_HEADER_top_part.md'))
|
||||
if 1 in files_to_include: files.append(readme)
|
||||
if 2 in files_to_include: files.append(readfile('3_FOOTER.md'))
|
||||
if 3 in files_to_include: files.append(readfile('4_Release_notes.md'))
|
||||
if 2 in files_to_include: files.append(readfile('markdown input files/3_FOOTER.md'))
|
||||
if 3 in files_to_include: files.append(readfile('markdown input files/4_Release_notes.md'))
|
||||
|
||||
Joined_MARKDOWN = '\n\n'.join(files) if do_full_readme or files else readme
|
||||
|
||||
|
@ -763,7 +773,7 @@ def main(do_full_readme=False,
|
|||
if logger:
|
||||
logger.error(f'Error in main')
|
||||
|
||||
logger.save_messages()
|
||||
logger.save()
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -51,6 +51,8 @@ HOW DO I INSERT IMAGES ???
|
|||
|
||||
## Python GUI For Humans - Transforms tkinter, Qt, Remi, WxPython into portable people-friendly Pythonic interfaces
|
||||
|
||||
## <span>The Call Reference Section Moved to <a href="https://pysimplegui.readthedocs.io/en/latest/call%20reference/">here</a></span>
|
||||
|
||||
### This manual is crammed full of answers so start your search for answers here. Read/Search this prior to opening an Issue on GitHub. Press Control F and type.
|
||||
---
|
||||
|
||||
|
@ -80,7 +82,7 @@ window = sg.Window('Window Title', layout)
|
|||
# Event Loop to process "events" and get the "values" of the inputs
|
||||
while True:
|
||||
event, values = window.read()
|
||||
if event in (None, 'Cancel'): # if user closes window or clicks cancel
|
||||
if event == sg.WIN_CLOSED or event == 'Cancel': # if user closes window or clicks cancel
|
||||
break
|
||||
print('You entered ', values[0])
|
||||
|
||||
|
@ -138,8 +140,6 @@ and returns the value input as well as the button clicked.
|
|||
* 170+ Demo Programs teach you how to integrate with many popular packages like OpenCV, Matplotlib, PyGame, etc.
|
||||
* 200 pages of documentation, a Cookbook, built-in help using docstrings, in short it's heavily documented
|
||||
|
||||
#### July-2019 Note - This readme is being generated from the PySimpleGUI.py file located on GitHub. As a result, some of the calls or parameters may not match the PySimpleGUI that you pip installed.
|
||||
|
||||
## GUI Development does not have to be difficult nor painful. It can be (and is) FUN
|
||||
|
||||
#### What users are saying about PySimpleGUI
|
||||
|
@ -169,6 +169,14 @@ and returns the value input as well as the button clicked.
|
|||
|
||||
[ReadTheDocs](http://www.PySimpleGUI.org) <------ THE best place to read the docs due to TOC, all docs in 1 place, and better formatting. START here in your education. Easy to remember PySimpleGUI.org.
|
||||
|
||||
[The Call Reference](http://calls.PySimpleGUI.org) documentation is located on the same ReadTheDocs page as the main documentation, but it's on another tab that you'll find across the top of the page.
|
||||
|
||||
The quick way to remember the documentation addresses is to use these addresses:
|
||||
|
||||
http://docs.PySimpleGUI.org
|
||||
http://calls.PySimpleGUI.org
|
||||
|
||||
|
||||
#### Quick Links To Help and The Latest News and Releases
|
||||
|
||||
|
||||
|
@ -191,7 +199,7 @@ and returns the value input as well as the button clicked.
|
|||
[How to submit an Issue](https://github.com/PySimpleGUI/PySimpleGUI/issues/1646)
|
||||
|
||||
|
||||
The YouTube videos - If you like instructional videos, there are over 15 videos made by PySimpleGUI project over the first 18 months.
|
||||
[The YouTube videos](http://YouTube.PySimpleGUI.org) - If you like instructional videos, there are over 15 videos made by PySimpleGUI project over the first 18 months.
|
||||
In 2020 a new series was begun. As of May 2020 there are 12 videos completed so far with many more to go....
|
||||
- [PySimpleGUI 2020 - The most up to date information about PySimpleGUI](https://www.youtube.com/playlist?list=PLl8dD0doyrvFfzzniWS7FXrZefWWExJ2e)
|
||||
- [5 part series of basics](https://www.youtube.com/playlist?list=PLl8dD0doyrvHMoJGTdMtgLuHymaqJVjzt)
|
||||
|
@ -210,25 +218,11 @@ YouTube Videos made by others. These have much higher production values than th
|
|||
|
||||
This User's Manual (also the project's readme) is one ***vital*** part of the PySimpleGUI programming environment. The best place to read it is at http://www.PySimpleGUI.org
|
||||
|
||||
If you are a professional or skilled in how to develop software, then you understand the role of documentation in the world of technology development. You can skip this bit.... look for the bold "**GO TO HERE**" below.
|
||||
|
||||
RTFM is not a new acronym. It stretches back to 1979, the dawn of the computer-era and in particular the microprocessor. The point is that this is not a new problem. It's a very old problem.
|
||||
|
||||
Bluntness is required here as the subtle approach has not worked in the past:
|
||||
If you are a professional or skilled in how to develop software, then you understand the role of documentation in the world of technology development. Use it, please.
|
||||
|
||||
***It WILL be required, at times, for you to read or search this document in order to be successful.***
|
||||
|
||||
Re-read that statement. This **will** be a serious problem for you if you're the type of person that finds it "quicker and easier to post on StackOverflow rather than reading documentation".
|
||||
|
||||
If you have not yet matured to the point you are able to understand this skill or choose to not follow it, then please save ***everyone*** the pain of doing **for you** what you, as a developer, software engineer, or wanna be coder, must do on your own. It's a vital skill for you to learn.
|
||||
|
||||
Want to be a "real engineer"? Then follow "real engineering practices" such as "reading". You are learning a NEW GUI package. You've not seen anything like it. Don't be so arrogant as to believe you will never need to read documentation.
|
||||
|
||||
UGH, why does this need to be said?
|
||||
|
||||
***GO TO HERE*** if instructed above.
|
||||
|
||||
I apologize to the other 95% of you that this..... pathetic.... reminder needs to be added, but sadly there's a need for it.
|
||||
Using Stack Overflow and other sites to post your questions has resulted in advice given by a lot of users that have never looked at the package and are sometimes just flat bad advice. When possible, post an Issue on this GitHub. Definitely go through the Issue checklist. Take a look through the docs, again.
|
||||
|
||||
There are 5 resources that work together to provide to you the fastest path to success. They are:
|
||||
|
||||
|
@ -325,7 +319,7 @@ window = sg.Window('Window Title', layout)
|
|||
# Event Loop to process "events"
|
||||
while True:
|
||||
event, values = window.read()
|
||||
if event in (None, 'Cancel'):
|
||||
if event in (sg.WIN_CLOSED, 'Cancel'):
|
||||
break
|
||||
|
||||
window.close()
|
||||
|
@ -468,7 +462,7 @@ import tkinter
|
|||
import cv2, PySimpleGUI as sg
|
||||
USE_CAMERA = 0 # change to 1 for front facing camera
|
||||
window, cap = sg.Window('Demo Application - OpenCV Integration', [[sg.Image(filename='', key='image')], ], location=(0, 0), grab_anywhere=True), cv2.VideoCapture(USE_CAMERA)
|
||||
while window(timeout=20)[0] is not None:
|
||||
while window(timeout=20)[0] != sg.WIN_CLOSED:
|
||||
window['image'](data=cv2.imencode('.png', cap.read()[1])[1].tobytes())
|
||||
```
|
||||
|
||||
|
@ -1176,6 +1170,13 @@ For python 3
|
|||
More information about installing tkinter can be found here: https://www.techinfected.net/2015/09/how-to-install-and-use-tkinter-in-ubuntu-debian-linux-mint.html
|
||||
|
||||
|
||||
### Installing typing module for Python 3.4 (Raspberry Pi)
|
||||
|
||||
In order for the docstrings to work correctly the `typing` module is used. In Python version 3.4 the typing module is not part of Python and must be installed separately. You'll see a warning printed on the console if this module isn't installed.
|
||||
|
||||
You can pip install `typing` just like PySimpleGUI. However it's not a requirement as PySimpleGUI will run fine without typing installed as it's only used by the docstrings.
|
||||
|
||||
|
||||
### Installing for Python 2.7
|
||||
|
||||
**IMPORTANT** PySimpleGUI27 will disappear from the GitHub on Dec 31, 2019. PLEASE migrate to 3.6 at least. It's not painful for most people.
|
||||
|
@ -1273,7 +1274,7 @@ You can also test by using the REPL....
|
|||
>>> PySimpleGUI.main()
|
||||
```
|
||||
|
||||
You will see a "test harness" that exercises the SDK, tells you the version number, allows you to try
|
||||
You will see a "test harness" that exercises the SDK, tells you the version number, allows you to try a number of features as well as access the built-in GitHub upgrade utility.
|
||||
|
||||
### Finding Out Where Your PySimpleGUI Is Coming From
|
||||
|
|
@ -41,7 +41,7 @@ You can, and will be able to for some time, use both names. However, at some po
|
|||
|
||||
The help system will work with both names as will your IDE's docstring viewing. However, the result found will show the CamelCase names. For example `help(sg.Window.read)` will show the CamelCase name of the method/function. This is what will be returned:
|
||||
|
||||
`Read(self, timeout=None, timeout_key='__TIMEOUT__')`
|
||||
`Read(self, timeout=None, timeout_key='__TIMEOUT__', close=False)`
|
||||
|
||||
## The Renaming Convention
|
||||
|
||||
|
@ -743,7 +743,7 @@ The button value from a Read call will be one of 2 values:
|
|||
|
||||
If a button has a key set when it was created, then that key will be returned, regardless of what text is shown on the button. If no key is set, then the button text is returned. If no button was clicked, but the window returned anyway, the event value is the key that caused the event to be generated. For example, if `enable_events` is set on an `Input` Element and someone types a character into that `Input` box, then the event will be the key of the input box.
|
||||
|
||||
### **None is returned when the user clicks the X to close a window.**
|
||||
### **WIN_CLOSED (None) is returned when the user clicks the X to close a window.**
|
||||
|
||||
If your window has an event loop where it is read over and over, remember to give your user an "out". You should ***always check for a None value*** and it's a good practice to provide an Exit button of some kind. Thus design patterns often resemble this Event Loop:
|
||||
|
||||
|
@ -978,7 +978,7 @@ Clicking the Submit button caused the window call to return. The call to Popup
|
|||
|
||||
|
||||
|
||||
**`Note, event values can be None`**. The value for `event` will be the text that is displayed on the button element when it was created or the key for the button. If the user closed the window using the "X" in the upper right corner of the window, then `event` will be `None`. It is ***vitally*** ***important*** that your code contain the proper checks for None.
|
||||
**`Note, event values can be None`**. The value for `event` will be the text that is displayed on the button element when it was created or the key for the button. If the user closed the window using the "X" in the upper right corner of the window, then `event` will be `sg.WIN_CLOSED` which is equal to `None`. It is ***vitally*** ***important*** that your code contain the proper checks for `sg.WIN_CLOSED`.
|
||||
|
||||
For "persistent windows", **always give your users a way out of the window**. Otherwise you'll end up with windows that never properly close. It's literally 2 lines of code that you'll find in every Demo Program. While you're at it, make sure a `window.close()` call is after your event loop so that your window closes for sure.
|
||||
|
||||
|
@ -1291,7 +1291,7 @@ Call to force a window to go through the final stages of initialization. This w
|
|||
If you want to call an element's `Update` method or call a `Graph` element's drawing primitives, you ***must*** either call `Read` or `Finalize` prior to making those calls.
|
||||
|
||||
|
||||
#### read(timeout=None, timeout_key=TIMEOUT_KEY)
|
||||
#### read(timeout=None, timeout_key=TIMEOUT_KEY, close=False)
|
||||
|
||||
Read the Window's input values and button clicks in a blocking-fashion
|
||||
|
||||
|
@ -2479,7 +2479,7 @@ while (True):
|
|||
# This is the code that reads and updates your window
|
||||
event, values = window.read(timeout=50)
|
||||
print(event)
|
||||
if event in ('Quit', None):
|
||||
if event in ('Quit', sg.WIN_CLOSED):
|
||||
break
|
||||
|
||||
window.close() # Don't forget to close your window!
|
||||
|
@ -3872,7 +3872,7 @@ win2_active = False
|
|||
while True:
|
||||
ev1, vals1 = win1.read(timeout=100)
|
||||
win1['-OUTPUT-'].update(vals1[0])
|
||||
if ev1 is None or ev1 == 'Exit':
|
||||
if ev1 == sg.WIN_CLOSED or ev1 == 'Exit':
|
||||
break
|
||||
|
||||
if not win2_active and ev1 == 'Launch 2':
|
||||
|
@ -3884,7 +3884,7 @@ while True:
|
|||
|
||||
if win2_active:
|
||||
ev2, vals2 = win2.read(timeout=100)
|
||||
if ev2 is None or ev2 == 'Exit':
|
||||
if ev2 == sg.WIN_CLOSED or ev2 == 'Exit':
|
||||
win2_active = False
|
||||
win2.close()
|
||||
```
|
||||
|
@ -3906,7 +3906,7 @@ win1 = sg.Window('Window 1', layout)
|
|||
win2_active=False
|
||||
while True:
|
||||
ev1, vals1 = win1.read(timeout=100)
|
||||
if ev1 is None:
|
||||
if ev1 == sg.WIN_CLOSED:
|
||||
break
|
||||
win1.FindElement('-OUTPUT-').update(vals1[0])
|
||||
|
||||
|
@ -3919,7 +3919,7 @@ while True:
|
|||
win2 = sg.Window('Window 2', layout2)
|
||||
while True:
|
||||
ev2, vals2 = win2.read()
|
||||
if ev2 is None or ev2 == 'Exit':
|
||||
if ev2 == sg.WIN_CLOSED or ev2 == 'Exit':
|
||||
win2.close()
|
||||
win2_active = False
|
||||
win1.UnHide()
|
|
@ -95,6 +95,11 @@ Run this command on your Mac
|
|||
|
||||
> pyinstaller --onefile --add-binary='/System/Library/Frameworks/Tk.framework/Tk':'tk' --add-binary='/System/Library/Frameworks/Tcl.framework/Tcl':'tcl' your_program.py
|
||||
|
||||
Another also mentioned it may be helpful to add the "windowed" option so that a console is not opened. That should make the command:
|
||||
|
||||
> pyinstaller --onefile --add-binary='/System/Library/Frameworks/Tk.framework/Tk':'tk' --windowed --add-binary='/System/Library/Frameworks/Tcl.framework/Tcl':'tcl' your_program.py
|
||||
|
||||
|
||||
|
||||
This info was located on Reddit with the source traced back to:
|
||||
https://github.com/pyinstaller/pyinstaller/issues/1350
|
|
@ -1216,9 +1216,65 @@ Long list of stuff!
|
|||
* Changed the misleading TRANSPARENT_BUTTON constant with an attempt using themes calls
|
||||
|
||||
|
||||
## 4.20.0 PySimpleGUI 6-Jun-2020
|
||||
|
||||
Fixes and new features... broad range
|
||||
|
||||
* Fix for Typing import for Pi (3.4) users. Now "tries" to import typing
|
||||
* Tooltip fonts - can change the font for tooltips
|
||||
* Fixed tearoff for Menus. Had stoppped working
|
||||
* Radio - If element is updated to False, the entire group of radio buttons will be set to false tooltips
|
||||
* Multiline - fix for colors. Only set tags for output that has specific colors
|
||||
* Multiline - keeping track of disabled with Disabled mumber variable
|
||||
* Progress bar
|
||||
* Added class variable "uniqueness counter" so that every bar will have its own settings
|
||||
* Needed in case the same key is used in another window
|
||||
* Fix for stdout being reset if someone sets flush on their call to print
|
||||
* Mac special case added to tkfiledialog.askdirectory just like on askopenfilename
|
||||
* Tab - can "update" the title
|
||||
* Menu update - was not applying font when updating the menu
|
||||
* Window.set_title - allows you to change the title for a window
|
||||
* Added searching through Panes when looking for element with focus
|
||||
* Removed Python 2 Add Menu Item code
|
||||
* Added font to buttonmenu.
|
||||
* Added font to the combobox drop-down list (wow what a pain)
|
||||
* Table now uses the element's padding rather than 0,0
|
||||
* Tree now uses the element's padding rather than 0,0
|
||||
* set_options - added ability to set the tooltip font
|
||||
* Fixed a couple of docstrings
|
||||
* Reworked main() test harness to display DETAILED tkinter info and use better colors
|
||||
|
||||
|
||||
## 4.21.0 PySimpleGUI 27-Jun-2020
|
||||
|
||||
Horizontal Separator, cprint, docstrings
|
||||
|
||||
* New color printing function cprint - enables easy color printing to an element
|
||||
* Tons of docstring fixups (300+ changes)
|
||||
* Removed old Python2 checks
|
||||
* Added Element.set_vscroll_position - scroll to a particular % of the way into a scrollable widget
|
||||
* Input Text - new parameters
|
||||
* border_width
|
||||
* read_only (for tkinter will have to be disabled OR readonly. Cannot be both)
|
||||
* disabled_readonly_background_color
|
||||
* disabled_readonly_text_color
|
||||
* Radio - Backed out the change that cleared all buttons in group because already have that ability using reset_group
|
||||
* Graph drag mouse up events returned as either a string + "+UP" (as before) or as a tuple with "+UP" being added onto a tuple key
|
||||
* Vertical separator - added key and color - color defaults to text color
|
||||
* Horizontal separator! (FINALLY). Color defaults to text color
|
||||
* Fix for Table and Tree elements not automatically getting a key generated if one wasn't supplied
|
||||
* Made key parameter for one_line_progress_meter have a default value so don't have to specify it when you have only 1 running
|
||||
* theme_add_new - adds a new theme entry given a theme name and a dictionary entry. This way you don't have to directly modify the theme dictionary
|
||||
* Added initial_folder to popup_get_folder when there is no window
|
||||
* Added default_path to popup_get_file when there is no window
|
||||
* Fix for removing too many PySimpleGUI installs when using the GitHub upgrade tooltip
|
||||
|
||||
|
||||
|
||||
|
||||
### Upcoming
|
||||
|
||||
There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the currnt ports that are underway.
|
||||
There will always be overlapping work as the ports will never actually be "complete" as there's always something new that can be built. However there's a definition for the base functionality for PySimpleGUI. This is what is being strived for with the current ports that are underway.
|
||||
|
||||
The current road ahead is to complete these ports - Qt (very close), Web (pretty close), Wx (not all that close).
|
||||
|
||||
|
@ -1236,7 +1292,7 @@ In addition to the ports there is ongoing work with educators that want to bring
|
|||
|
||||
It's a recipe for success if done right. PySimpleGUI has completed the "Make it run" phase. It's far from "right" in many ways. These are being worked on. The module has historically been particularly poor for PEP8 compliance. It was a learning exercise that turned into a somewhat complete GUI solution for lightweight problems.
|
||||
|
||||
While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP8 naming conventions. A set of "PEP8 Bindings" was released in summar 2019 to ensure the enternally facing interfaces all adhere to PEP8 names.
|
||||
While the internals to PySimpleGUI are a tad sketchy, the public interfaces into the SDK are more strictly defined and comply with PEP8 naming conventions. A set of "PEP8 Bindings" was released in summar 2019 to ensure the externally facing interfaces all adhere to PEP8 names.
|
||||
|
||||
Please log bugs and suggestions **only on the PySimpleGUI GitHub**! It will only make the code stronger and better in the end, a good thing for us all, right? Logging them elsewhere doesn't enable the core developer and other PySimpleGUI users to help. To make matters worse, you may get bad advice from other sites because there are simply not many PySimpleGUI experts, yet.
|
||||
|
||||
|
@ -1267,11 +1323,11 @@ tkinter is the "official" GUI that Python supports. It runs on Windows, Linux,
|
|||
From the start of the PSG project, tkinter was not meant to be the only underlying GUI framework for PySimpleGUI. It is merely a starting point. All journeys begin with one step forward and choosing tkinter was the first of many steps for PySimpleGUI. Now there are 4 ports up and running - tkinter, WxPython, Qt and Remi (web support)
|
||||
|
||||
|
||||
## Author & Owner
|
||||
# Author & Owner
|
||||
|
||||
The PySimpleGUI Organization
|
||||
Written and owned by The PySimpleGUI Organization
|
||||
|
||||
This documentation as well as all PySimpleGUI code is Copyright 2018, 2019, 2020 by PySimpleGUI.org
|
||||
This documentation as well as all PySimpleGUI documentation and code is Copyright 2018, 2019, 2020 by PySimpleGUI.org
|
||||
|
||||
Send correspondence to PySimpleGUI@PySimpleGUI.com
|
||||
|
||||
|
@ -1289,4 +1345,4 @@ If you've helped, I sure hope that you feel like you've been properly thanked.
|
|||
|
||||
In response to a number of email contacts from individuals and corporations that are using PySimpleGUI that wanted to financially support the project a "Support" Button was added to the GitHub site. This support button is connected with a PayPal account. If you wish to help support this currently freely supplied software and free technical support, then follow this link: www.paypal.me/psgui .
|
||||
|
||||
To be clear, this is not a solicitation for your money. No one is being directly asked to support / contribute. The project is self-funded and there are ongoing costs just to offer the software (URLs, ReadTheDocs, etc). If you're a corporate user and find that PySimpleGUI is helping you financially, that's awesome. If you want to help ensure PySimpleGUI has a future, you now have that option to help. It's likely that at some point the costs will become too high for the project to continue, but until then we'll all enjoy the successes we're having.
|
||||
To be clear, this is not a solicitation for your money. No one is being directly asked to support / contribute. The project is self-funded and there are ongoing costs just to offer the software (URLs, ReadTheDocs, etc). If you're a corporate user and find that PySimpleGUI is helping you financially, that's awesome. If you want to help ensure PySimpleGUI has a future, you now have that option to help. It's likely that at some point the costs will become too high for the project to continue to be free, but until then we'll all enjoy the successes we're having.
|
|
@ -1,7 +1,14 @@
|
|||
![pysimplegui_logo](https://user-images.githubusercontent.com/13696193/43165867-fe02e3b2-8f62-11e8-9fd0-cc7c86b11772.png)
|
||||
|
||||
# ELEMENT AND FUNCTION CALL REFERENCE
|
||||
|
||||
NOTE that this documentation section is created using the ***GitHUB released PySimpleGUI.py file***. This means you're seeing the tkinter port only and some of the changes might not yet be released on PyPI. Some of the calls may not be available to you or your port (Qt, Wx, Web). And some of the parameters may be different. We're working on adding docstrings to all the ports which will enable this kind of document to be available for each port.
|
||||
Here you will find the details for all Elements, Objects, and Functions that are available to you. If you want to use a complex element and don't understand the parameters, then this is the right place to come. For every element you're shown the parameters used to create it as well as all methods available to call.
|
||||
|
||||
## Currently PySimpleGUI (tkinter) only
|
||||
|
||||
This documentation is created using the PySimpleGUI.py file which means it's based on the tkinter code. Some of the calls are different, might not exist at all, or there may be more methods/functions for the other PySimpleGUI ports (Qt, Wx, Web).
|
||||
|
||||
Work is underway to get the PySimpleGUIQt docstrings completed and corrected.
|
||||
|
||||
## Caution - Some functions / methods may be internal only yet exposed in this documentation
|
||||
|
||||
|
@ -58,6 +65,9 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### set_tooltip
|
||||
<!-- <+Button.set_tooltip+> -->
|
||||
|
||||
### set_vscroll_position
|
||||
<!-- <+Button.set_vscroll_position+> -->
|
||||
|
||||
### unbind
|
||||
<!-- <+Button.unbind+> -->
|
||||
|
||||
|
@ -110,6 +120,9 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### unbind
|
||||
<!-- <+ButtonMenu.unbind+> -->
|
||||
|
||||
### set_vscroll_position
|
||||
<!-- <+ButtonMenu.set_vscroll_position+> -->
|
||||
|
||||
### unhide_row
|
||||
<!-- <+ButtonMenu.unhide_row+> -->
|
||||
|
||||
|
@ -159,6 +172,7 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### unbind
|
||||
<!-- <+Canvas.unbind+> -->
|
||||
|
||||
|
||||
### unhide_row
|
||||
<!-- <+Canvas.unhide_row+> -->
|
||||
|
||||
|
@ -266,6 +280,9 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### unbind
|
||||
<!-- <+Column.unbind+> -->
|
||||
|
||||
### set_vscroll_position
|
||||
<!-- <+Column.set_vscroll_position+> -->
|
||||
|
||||
### unhide_row
|
||||
<!-- <+Column.unhide_row+> -->
|
||||
|
||||
|
@ -546,6 +563,50 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### update
|
||||
<!-- <+Graph.update+> -->
|
||||
|
||||
|
||||
|
||||
## HorizontalSeparator Element
|
||||
<!-- <+HorizontalSeparator.doc+> -->
|
||||
<!-- <+HorizontalSeparator.__init__+> -->
|
||||
|
||||
### SetFocus
|
||||
<!-- <+HorizontalSeparator.SetFocus+> -->
|
||||
|
||||
### SetTooltip
|
||||
<!-- <+HorizontalSeparator.SetTooltip+> -->
|
||||
|
||||
### bind
|
||||
<!-- <+HorizontalSeparator.bind+> -->
|
||||
|
||||
### expand
|
||||
<!-- <+HorizontalSeparator.expand+> -->
|
||||
|
||||
### get_size
|
||||
<!-- <+HorizontalSeparator.get_size+> -->
|
||||
|
||||
### hide_row
|
||||
<!-- <+HorizontalSeparator.hide_row+> -->
|
||||
|
||||
### set_cursor
|
||||
<!-- <+HorizontalSeparator.set_cursor+> -->
|
||||
|
||||
### set_focus
|
||||
<!-- <+HorizontalSeparator.set_focus+> -->
|
||||
|
||||
### set_size
|
||||
<!-- <+HorizontalSeparator.set_size+> -->
|
||||
|
||||
### set_tooltip
|
||||
<!-- <+HorizontalSeparator.set_tooltip+> -->
|
||||
|
||||
### unbind
|
||||
<!-- <+HorizontalSeparator.unbind+> -->
|
||||
|
||||
### unhide_row
|
||||
<!-- <+HorizontalSeparator.unhide_row+> -->
|
||||
|
||||
|
||||
|
||||
## Image Element
|
||||
<!-- <+Image.doc+> -->
|
||||
<!-- <+Image.__init__+> -->
|
||||
|
@ -711,6 +772,9 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### set_value
|
||||
<!-- <+Listbox.set_value+> -->
|
||||
|
||||
### set_vscroll_position
|
||||
<!-- <+Listbox.set_vscroll_position+> -->
|
||||
|
||||
### unbind
|
||||
<!-- <+Listbox.unbind+> -->
|
||||
|
||||
|
@ -812,6 +876,9 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### set_tooltip
|
||||
<!-- <+Multiline.set_tooltip+> -->
|
||||
|
||||
### set_vscroll_position
|
||||
<!-- <+Multiline.set_vscroll_position+> -->
|
||||
|
||||
### unbind
|
||||
<!-- <+Multiline.unbind+> -->
|
||||
|
||||
|
@ -859,6 +926,9 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### set_tooltip
|
||||
<!-- <+OptionMenu.set_tooltip+> -->
|
||||
|
||||
### set_vscroll_position
|
||||
<!-- <+OptionMenu.set_vscroll_position+> -->
|
||||
|
||||
### unbind
|
||||
<!-- <+OptionMenu.unbind+> -->
|
||||
|
||||
|
@ -914,6 +984,11 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### tk_out
|
||||
<!-- <+Output.tk_out+> -->
|
||||
|
||||
|
||||
### set_vscroll_position
|
||||
<!-- <+Output.set_vscroll_position+> -->
|
||||
|
||||
|
||||
### unbind
|
||||
<!-- <+Output.unbind+> -->
|
||||
|
||||
|
@ -1378,6 +1453,10 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### set_tooltip
|
||||
<!-- <+TabGroup.set_tooltip+> -->
|
||||
|
||||
### set_vscroll_position
|
||||
<!-- <+Table.set_vscroll_position+> -->
|
||||
|
||||
|
||||
### unbind
|
||||
<!-- <+TabGroup.unbind+> -->
|
||||
|
||||
|
@ -1530,6 +1609,9 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### set_tooltip
|
||||
<!-- <+Tree.set_tooltip+> -->
|
||||
|
||||
### set_vscroll_position
|
||||
<!-- <+Tree.set_vscroll_position+> -->
|
||||
|
||||
### unbind
|
||||
<!-- <+Tree.unbind+> -->
|
||||
|
||||
|
@ -1592,6 +1674,264 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
### unhide_row
|
||||
<!-- <+VerticalSeparator.unhide_row+> -->
|
||||
|
||||
|
||||
## Window
|
||||
<!-- <+Window.doc+> -->
|
||||
<!-- <+Window.__init__+> -->
|
||||
|
||||
### AddRow
|
||||
<!-- <+Window.AddRow+> -->
|
||||
|
||||
### AddRows
|
||||
<!-- <+Window.AddRows+> -->
|
||||
|
||||
### AlphaChannel
|
||||
<!-- <+Window.AlphaChannel+> -->
|
||||
|
||||
### BringToFront
|
||||
<!-- <+Window.BringToFront+> -->
|
||||
|
||||
### Close
|
||||
<!-- <+Window.Close+> -->
|
||||
|
||||
### CurrentLocation
|
||||
<!-- <+Window.CurrentLocation+> -->
|
||||
|
||||
### Disable
|
||||
<!-- <+Window.Disable+> -->
|
||||
|
||||
### DisableDebugger
|
||||
<!-- <+Window.DisableDebugger+> -->
|
||||
|
||||
### Disappear
|
||||
<!-- <+Window.Disappear+> -->
|
||||
|
||||
### Elem
|
||||
<!-- <+Window.Elem+> -->
|
||||
|
||||
### Element
|
||||
<!-- <+Window.Element+> -->
|
||||
|
||||
### Enable
|
||||
<!-- <+Window.Enable+> -->
|
||||
|
||||
### EnableDebugger
|
||||
<!-- <+Window.EnableDebugger+> -->
|
||||
|
||||
### Fill
|
||||
<!-- <+Window.Fill+> -->
|
||||
|
||||
### Finalize
|
||||
<!-- <+Window.Finalize+> -->
|
||||
|
||||
### Find
|
||||
<!-- <+Window.Find+> -->
|
||||
|
||||
### FindElement
|
||||
<!-- <+Window.FindElement+> -->
|
||||
|
||||
### FindElementWithFocus
|
||||
<!-- <+Window.FindElementWithFocus+> -->
|
||||
|
||||
### GetScreenDimensions
|
||||
<!-- <+Window.GetScreenDimensions+> -->
|
||||
|
||||
### GrabAnyWhereOff
|
||||
<!-- <+Window.GrabAnyWhereOff+> -->
|
||||
|
||||
### GrabAnyWhereOn
|
||||
<!-- <+Window.GrabAnyWhereOn+> -->
|
||||
|
||||
### Hide
|
||||
<!-- <+Window.Hide+> -->
|
||||
|
||||
### Layout
|
||||
<!-- <+Window.Layout+> -->
|
||||
|
||||
### LoadFromDisk
|
||||
<!-- <+Window.LoadFromDisk+> -->
|
||||
|
||||
### Maximize
|
||||
<!-- <+Window.Maximize+> -->
|
||||
|
||||
### Minimize
|
||||
<!-- <+Window.Minimize+> -->
|
||||
|
||||
### Move
|
||||
<!-- <+Window.Move+> -->
|
||||
|
||||
### Normal
|
||||
<!-- <+Window.Normal+> -->
|
||||
|
||||
### Read
|
||||
<!-- <+Window.Read+> -->
|
||||
|
||||
### Reappear
|
||||
<!-- <+Window.Reappear+> -->
|
||||
|
||||
### Refresh
|
||||
<!-- <+Window.Refresh+> -->
|
||||
|
||||
### SaveToDisk
|
||||
<!-- <+Window.SaveToDisk+> -->
|
||||
|
||||
### SendToBack
|
||||
<!-- <+Window.SendToBack+> -->
|
||||
|
||||
### SetAlpha
|
||||
<!-- <+Window.SetAlpha+> -->
|
||||
|
||||
### SetIcon
|
||||
<!-- <+Window.SetIcon+> -->
|
||||
|
||||
### SetTransparentColor
|
||||
<!-- <+Window.SetTransparentColor+> -->
|
||||
|
||||
### Size
|
||||
<!-- <+Window.Size+> -->
|
||||
|
||||
### UnHide
|
||||
<!-- <+Window.UnHide+> -->
|
||||
|
||||
### VisibilityChanged
|
||||
<!-- <+Window.VisibilityChanged+> -->
|
||||
|
||||
### add_row
|
||||
<!-- <+Window.add_row+> -->
|
||||
|
||||
### add_rows
|
||||
<!-- <+Window.add_rows+> -->
|
||||
|
||||
### alpha_channel
|
||||
<!-- <+Window.alpha_channel+> -->
|
||||
|
||||
### bind
|
||||
<!-- <+Window.bind+> -->
|
||||
|
||||
### bring_to_front
|
||||
<!-- <+Window.bring_to_front+> -->
|
||||
|
||||
### close
|
||||
<!-- <+Window.close+> -->
|
||||
|
||||
### current_location
|
||||
<!-- <+Window.current_location+> -->
|
||||
|
||||
### disable
|
||||
<!-- <+Window.disable+> -->
|
||||
|
||||
### disable_debugger
|
||||
<!-- <+Window.disable_debugger+> -->
|
||||
|
||||
### disappear
|
||||
<!-- <+Window.disappear+> -->
|
||||
|
||||
### elem
|
||||
<!-- <+Window.elem+> -->
|
||||
|
||||
### element
|
||||
<!-- <+Window.element+> -->
|
||||
|
||||
### element_list
|
||||
<!-- <+Window.element_list+> -->
|
||||
|
||||
### enable
|
||||
<!-- <+Window.enable+> -->
|
||||
|
||||
### enable_debugger
|
||||
<!-- <+Window.enable_debugger+> -->
|
||||
|
||||
### extend_layout
|
||||
<!-- <+Window.extend_layout+> -->
|
||||
|
||||
### fill
|
||||
<!-- <+Window.fill+> -->
|
||||
|
||||
### finalize
|
||||
<!-- <+Window.finalize+> -->
|
||||
|
||||
### find
|
||||
<!-- <+Window.find+> -->
|
||||
|
||||
### find_element
|
||||
<!-- <+Window.find_element+> -->
|
||||
|
||||
### find_element_with_focus
|
||||
<!-- <+Window.find_element_with_focus+> -->
|
||||
|
||||
### get_screen_dimensions
|
||||
<!-- <+Window.get_screen_dimensions+> -->
|
||||
|
||||
### get_screen_size
|
||||
<!-- <+Window.get_screen_size+> -->
|
||||
|
||||
### grab_any_where_off
|
||||
<!-- <+Window.grab_any_where_off+> -->
|
||||
|
||||
### grab_any_where_on
|
||||
<!-- <+Window.grab_any_where_on+> -->
|
||||
|
||||
### hide
|
||||
<!-- <+Window.hide+> -->
|
||||
|
||||
### layout
|
||||
<!-- <+Window.layout+> -->
|
||||
|
||||
### load_from_disk
|
||||
<!-- <+Window.load_from_disk+> -->
|
||||
|
||||
### maximize
|
||||
<!-- <+Window.maximize+> -->
|
||||
|
||||
### minimize
|
||||
<!-- <+Window.minimize+> -->
|
||||
|
||||
### move
|
||||
<!-- <+Window.move+> -->
|
||||
|
||||
### normal
|
||||
<!-- <+Window.normal+> -->
|
||||
|
||||
### read
|
||||
<!-- <+Window.read+> -->
|
||||
|
||||
### reappear
|
||||
<!-- <+Window.reappear+> -->
|
||||
|
||||
### refresh
|
||||
<!-- <+Window.refresh+> -->
|
||||
|
||||
### save_to_disk
|
||||
<!-- <+Window.save_to_disk+> -->
|
||||
|
||||
### send_to_back
|
||||
<!-- <+Window.send_to_back+> -->
|
||||
|
||||
### set_alpha
|
||||
<!-- <+Window.set_alpha+> -->
|
||||
|
||||
### set_icon
|
||||
<!-- <+Window.set_icon+> -->
|
||||
|
||||
### set_title
|
||||
<!-- <+Window.set_title+> -->
|
||||
|
||||
### set_transparent_color
|
||||
<!-- <+Window.set_transparent_color+> -->
|
||||
|
||||
### size
|
||||
<!-- <+Window.size+> -->
|
||||
|
||||
### un_hide
|
||||
<!-- <+Window.un_hide+> -->
|
||||
|
||||
### visibility_changed
|
||||
<!-- <+Window.visibility_changed+> -->
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Window
|
||||
<!-- <+Window.doc+> -->
|
||||
<!-- <+Window.__init__+> -->
|
||||
|
@ -1846,10 +2186,12 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
|
||||
## Function Reference
|
||||
|
||||
<!-- <+func.CButton+> -->
|
||||
These are the functions available for you to call
|
||||
|
||||
## Button Related
|
||||
|
||||
<!-- <+func.CalendarButton+> -->
|
||||
<!-- <+func.Cancel+> -->
|
||||
<!-- <+func.CloseButton+> -->
|
||||
<!-- <+func.ColorChooserButton+> -->
|
||||
<!-- <+func.Debug+> -->
|
||||
<!-- <+func.DummyButton+> -->
|
||||
|
@ -1857,7 +2199,6 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
<!-- <+func.FileBrowse+> -->
|
||||
<!-- <+func.FileSaveAs+> -->
|
||||
<!-- <+func.FilesBrowse+> -->
|
||||
<!-- <+func.FillFormWithValues+> -->
|
||||
<!-- <+func.FolderBrowse+> -->
|
||||
<!-- <+func.Help+> -->
|
||||
<!-- <+func.No+> -->
|
||||
|
@ -1867,17 +2208,22 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
<!-- <+func.Ok+> -->
|
||||
<!-- <+func.Open+> -->
|
||||
<!-- <+func.Quit+> -->
|
||||
<!-- <+func.RButton+> -->
|
||||
<!-- <+func.ReadButton+> -->
|
||||
<!-- <+func.RealtimeButton+> -->
|
||||
<!-- <+func.Save+> -->
|
||||
<!-- <+func.SaveAs+> -->
|
||||
<!-- <+func.ScrolledTextBox+> -->
|
||||
<!-- <+func.SetGlobalIcon+> -->
|
||||
<!-- <+func.SetOptions+> -->
|
||||
<!-- <+func.Submit+> -->
|
||||
<!-- <+func.Yes+> -->
|
||||
|
||||
## Button No Longer To Be Used
|
||||
|
||||
Note - These are no longer recommended!
|
||||
They are shown here in case you run into them in some old code.
|
||||
|
||||
<!-- <+func.RButton+> -->
|
||||
<!-- <+func.ReadButton+> -->
|
||||
<!-- <+func.CButton+> -->
|
||||
<!-- <+func.CloseButton+> -->
|
||||
|
||||
|
||||
## Debug Window Output
|
||||
|
||||
|
@ -1892,6 +2238,11 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
<!-- <+func.PrintClose+> -->
|
||||
|
||||
|
||||
## Color Printing to Multiline Element of a Window
|
||||
|
||||
<!-- <+func.cprint+> -->
|
||||
<!-- <+func.cprint_set_output_destination+> -->
|
||||
|
||||
## OneLineProgressMeter
|
||||
|
||||
<!-- <+func.OneLineProgressMeter+> -->
|
||||
|
@ -1953,25 +2304,48 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
<!-- <+func.popup_timed+> -->
|
||||
<!-- <+func.popup_yes_no+> -->
|
||||
|
||||
Same as popup_scrolled
|
||||
|
||||
<!-- <+func.sprint+> -->
|
||||
<!-- <+func.ScrolledTextBox+> -->
|
||||
|
||||
|
||||
## PEP8 Function Bindings
|
||||
|
||||
|
||||
<!-- <+func.fill_form_with_values+> -->
|
||||
<!-- <+func.main+> -->
|
||||
<!-- <+func.obj_to_string+> -->
|
||||
<!-- <+func.obj_to_string_single_obj+> -->
|
||||
|
||||
## Settings
|
||||
|
||||
<!-- <+func.set_global_icon+> -->
|
||||
<!-- <+func.set_options+> -->
|
||||
|
||||
|
||||
### Non PEP8 version (same as PEP8 version)
|
||||
|
||||
<!-- <+func.SetGlobalIcon+> -->
|
||||
<!-- <+func.SetOptions+> -->
|
||||
|
||||
|
||||
## The Test Harness
|
||||
|
||||
Used to test the installation, get information about the versions, upgrade from GitHub
|
||||
|
||||
<!-- <+func.main+> -->
|
||||
<!-- <+func.test+> -->
|
||||
|
||||
|
||||
## Debugger
|
||||
|
||||
<!-- <+func.show_debugger_popout_window+> -->
|
||||
<!-- <+func.show_debugger_window+> -->
|
||||
<!-- <+func.sprint+> -->
|
||||
<!-- <+func.test+> -->
|
||||
|
||||
|
||||
|
||||
## Themes
|
||||
|
||||
<!-- <+func.theme+> -->
|
||||
<!-- <+func.theme_add_new+> -->
|
||||
<!-- <+func.theme_background_color+> -->
|
||||
<!-- <+func.theme_border_width+> -->
|
||||
<!-- <+func.theme_button_color+> -->
|
||||
|
@ -1989,6 +2363,12 @@ Here are all of the Elements, the Window & SystemTray classes, and all functions
|
|||
<!-- <+func.theme_text_element_background_color+> -->
|
||||
|
||||
|
||||
## Misc
|
||||
|
||||
<!-- <+func.FillFormWithValues+> -->
|
||||
<!-- <+func.fill_form_with_values+> -->
|
||||
|
||||
|
||||
## Old Themes (Look and Feel) - Replaced by theme()
|
||||
|
||||
<!-- <+func.ChangeLookAndFeel+> -->
|
|
@ -4,39 +4,29 @@
|
|||
"message_text": "STARTING",
|
||||
"message_time": 2
|
||||
},
|
||||
{
|
||||
"message_type": "warning",
|
||||
"message_text": "ALERT ------ Hi, Mike! Please, fix ':return:' in 'PopupNonBlocking' \tIF you want to see 'return' row in 'signature table'",
|
||||
"message_time": 3
|
||||
},
|
||||
{
|
||||
"message_type": "warning",
|
||||
"message_text": "ALERT ------ Hi, Mike! Please, fix ':return:' in 'PopupAnimated' \tIF you want to see 'return' row in 'signature table'",
|
||||
"message_time": 4
|
||||
},
|
||||
{
|
||||
"message_type": "info",
|
||||
"message_text": "\n=================================================\nSTARTING TO INSERT markdown text into 2_readme.md\n=================================================\n",
|
||||
"message_time": 5
|
||||
"message_time": 3
|
||||
},
|
||||
{
|
||||
"message_type": "info",
|
||||
"message_text": "DONE 8 TAGS:\n<!-- <+func.Popup+> --> - COMPLETE\n<!-- <+func.popup_scrolled+> --> - COMPLETE\n<!-- <+func.popup_no_wait+> --> - COMPLETE\n<!-- <+func.popup_get_text+> --> - COMPLETE\n<!-- <+func.popup_get_file+> --> - COMPLETE\n<!-- <+func.popup_get_folder+> --> - COMPLETE\n<!-- <+func.popup_animated+> --> - COMPLETE\n<!-- <+func.one_line_progress_meter+> --> - COMPLETE",
|
||||
"message_time": 6
|
||||
"message_time": 4
|
||||
},
|
||||
{
|
||||
"message_type": "info",
|
||||
"message_text": "No bad tags, YES!",
|
||||
"message_time": 7
|
||||
"message_time": 5
|
||||
},
|
||||
{
|
||||
"message_type": "info",
|
||||
"message_text": "Deleting html comments",
|
||||
"message_time": 8
|
||||
"message_time": 6
|
||||
},
|
||||
{
|
||||
"message_type": "info",
|
||||
"message_text": "ending. writing to a file///////////////",
|
||||
"message_time": 9
|
||||
"message_time": 7
|
||||
}
|
||||
]
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,60 +0,0 @@
|
|||
import inspect
|
||||
import PySimpleGUIlib
|
||||
|
||||
"""
|
||||
Create All Possible Tags
|
||||
Will output to STDOUT all of the different tags for classes, members and functions for a given PySimpleGUIlib.py
|
||||
file. Functions that begin with _ are filtered out from the list.
|
||||
Displays the results in a PySimpleGUI window which can be used to copy and paste into other places.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
def new_name(name):
|
||||
name = name.replace("OK", "*1")
|
||||
name = name.replace("TK", "*2")
|
||||
name = name.replace("RGB", "*3")
|
||||
new = name[0].lower()
|
||||
for c in name[1:]:
|
||||
new += '_' + c.lower() if (c.isupper() or c == "*") else c
|
||||
new=new.replace("*1", "ok")
|
||||
new = new.replace("*2", "tk")
|
||||
new = new.replace("*3", "rgb")
|
||||
return new
|
||||
|
||||
layout = [[PySimpleGUIlib.Output(size=(600,300))]]
|
||||
window = PySimpleGUIlib.Window('Dump of tags', layout, resizable=True).Finalize()
|
||||
|
||||
psg_members = inspect.getmembers(PySimpleGUIlib)
|
||||
|
||||
psg_funcs = [o for o in psg_members if inspect.isfunction(o[1])]
|
||||
psg_classes = [o for o in psg_members if inspect.isclass(o[1])]
|
||||
# I don't know how this magic filtering works, I just know it works. "Private" stuff (begins with _) are somehow
|
||||
# excluded from the list with the following 2 lines of code. Very nicely done Kol-ee-ya!
|
||||
psg_classes_ = list(set([i[1] for i in psg_classes])) # filtering of anything that starts with _ (methods, classes, etc)
|
||||
psg_classes = list(zip([i.__name__ for i in psg_classes_], psg_classes_))
|
||||
|
||||
for pclass in sorted(psg_classes):
|
||||
if 'Tk' in pclass[0] or 'TK' in pclass[0] or 'Element' == pclass[0]: # or 'Window' == i[0]:
|
||||
continue
|
||||
# print(f'### {pclass[0]} Element')
|
||||
# print('')
|
||||
# print(f'<!-- <+{pclass[0]}.doc+> -->')
|
||||
# print(f'<!-- <+{pclass[0]}.__init__+> -->')
|
||||
print('')
|
||||
print(f'{pclass[0]} methods in PEP8 format --------------------------------------')
|
||||
for funcs in inspect.getmembers(pclass[1]):
|
||||
if '_' not in funcs[0]:
|
||||
# print(f'{pclass[0]}.{new_name(funcs[0])} = {pclass[0]}.{funcs[0]}') # version that has class on front
|
||||
print(f'{new_name(funcs[0])} = {funcs[0]}') # version without class on front (use for most)
|
||||
# print('\n'.join([f"#### {j[0]}\n\n<!-- <+{pclass[0]}.{j[0]}+> -->\n" for j in inspect.getmembers(pclass[1]) if '_' not in j[0]]))
|
||||
|
||||
# print('\n------------------------- Functions start here -------------------------\n')
|
||||
#
|
||||
for f in psg_funcs:
|
||||
if f[0][0] == '_':
|
||||
continue
|
||||
print(f'{new_name(f[0])} = {f[0]}')
|
||||
# print(f"<!-- <+func.{f[0]}+> -->")
|
||||
|
||||
window.Read()
|
19427
readme_creator/readme.md
19427
readme_creator/readme.md
File diff suppressed because it is too large
Load Diff
|
@ -1,18 +1,39 @@
|
|||
import datetime,time,os
|
||||
cd = CD = os.path.dirname(os.path.abspath(__file__))
|
||||
import re,datetime,time,os,platform,json,PySimpleGUI as sg; from subprocess import Popen; from make_real_readme import main
|
||||
cd = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
from make_real_readme import main
|
||||
def readfile(filename):
|
||||
with open(filename, 'r', encoding='utf-8') as ff: return ff.read()
|
||||
def writefile(fpath, content):
|
||||
with open(fpath, 'w', encoding='utf-8') as ff: ff.write(content)
|
||||
import json
|
||||
def writejson(a_path:str, a_dict:dict) -> None:
|
||||
with open(a_path, 'w', encoding='utf-8') as output_file:
|
||||
json.dump(a_dict, output_file, ensure_ascii=False, indent=2)
|
||||
with open(a_path, 'w', encoding='utf-8') as output_file: json.dump(a_dict, output_file, ensure_ascii=False, indent=2)
|
||||
def readjson(a_path:str) -> dict:
|
||||
with open(a_path, 'r', encoding='utf-8') as f: return json.load(f)
|
||||
|
||||
|
||||
def openfile(a_path):
|
||||
# File exists?
|
||||
if not os.path.exists(a_path): return sg.Popup(f"Error! This file doesn't exists: {a_path}")
|
||||
|
||||
# check: OS
|
||||
if 'Windows' in platform.system():
|
||||
os.startfile(a_path)
|
||||
|
||||
elif 'Linux' in platform.system():
|
||||
Popen(f'exo-open "{a_path}"', shell=True)
|
||||
|
||||
def opendir(a_path):
|
||||
# Folder exists?
|
||||
if not os.path.exists(a_path): return sg.Popup(f"Error! This directory doesn't exists: {a_path}")
|
||||
|
||||
# check: OS
|
||||
if 'Windows' in platform.system():
|
||||
os.startfile(a_path)
|
||||
|
||||
elif 'Linux' in platform.system():
|
||||
Popen(f'exo-open --launch FileManager --working-directory "{a_path}"', shell=True)
|
||||
|
||||
|
||||
########################################################################
|
||||
# __ _ _ #
|
||||
# / _(_) | | #
|
||||
|
@ -23,56 +44,22 @@ def readjson(a_path:str) -> dict:
|
|||
# __/ | #
|
||||
# |___/ #
|
||||
########################################################################
|
||||
OUTPUT_FILENAME = 'readme.md'
|
||||
def load_configs(): return readjson(os.path.join(cd, 'app_configs.json'))
|
||||
def save_configs(a_config:dict): writejson(os.path.join(cd, 'app_configs.json'), a_config)
|
||||
|
||||
##-#-#-# ##-#-#-#
|
||||
# Pre-process logic
|
||||
##-#-#-# ##-#-#-#
|
||||
|
||||
line_break = '<br>'
|
||||
# line_break can be:
|
||||
# - '<br>'
|
||||
# - ' \n '
|
||||
|
||||
method = 'with logs'
|
||||
# method can be:
|
||||
# - 'simple, no log'
|
||||
# - 'with logs'
|
||||
APP_CONFIGS = load_configs()
|
||||
README_OFILENAME = APP_CONFIGS['README_FILENAME']
|
||||
CALL_REFERENCE_OFILENAME = APP_CONFIGS['CALL_REFERENCE_FILENAME']
|
||||
|
||||
|
||||
##-#-#-# ##-#-#-#
|
||||
# Post-process logic
|
||||
##-#-#-# ##-#-#-#
|
||||
enable_popup = True
|
||||
insert_md_section_for__class_methods = False
|
||||
remove_repeated_sections_classmethods = False
|
||||
|
||||
|
||||
|
||||
##############
|
||||
# __ #
|
||||
# /_ | #
|
||||
# | | #
|
||||
# | | #
|
||||
# | | #
|
||||
# |_| #
|
||||
##############
|
||||
if method == 'simple, no log':
|
||||
main(logger=None,
|
||||
insert_md_section_for__class_methods=insert_md_section_for__class_methods,
|
||||
remove_repeated_sections_classmethods=remove_repeated_sections_classmethods,
|
||||
files_to_include=[0, 1, 2, 3],
|
||||
output_name=OUTPUT_FILENAME,
|
||||
delete_html_comments=True)
|
||||
|
||||
################
|
||||
# ___ #
|
||||
# |__ \ #
|
||||
# ) | #
|
||||
# / / #
|
||||
# / /_ #
|
||||
# |____| #
|
||||
################
|
||||
class BESTLOG(object):
|
||||
def __init__(self, filename):
|
||||
# my_file = logging.FileHandler(filename, mode='w')
|
||||
|
@ -187,24 +174,42 @@ class BESTLOG(object):
|
|||
|
||||
return error_list, warning_list, info_list, debug_list, warning_info_
|
||||
|
||||
def compile_all_stuff(**kw):
|
||||
# import logging
|
||||
def compile_call_ref(output_filename='output/LoG_call_ref', **kw):
|
||||
''' Compile a "5_call_reference.md" file'''
|
||||
|
||||
log_file = os.path.join(cd, 'LoG')
|
||||
log_obj = BESTLOG(log_file)
|
||||
log_obj = BESTLOG(os.path.join(cd, output_filename))
|
||||
|
||||
main(logger=log_obj,
|
||||
main_md_file='markdown input files/5_call_reference.md',
|
||||
insert_md_section_for__class_methods=insert_md_section_for__class_methods,
|
||||
remove_repeated_sections_classmethods=remove_repeated_sections_classmethods,
|
||||
files_to_include=[],
|
||||
output_name=CALL_REFERENCE_OFILENAME,
|
||||
delete_html_comments=True)
|
||||
log_obj.save()
|
||||
return log_obj.load(**kw)
|
||||
|
||||
def compile_readme(output_filename='output/LoG', **kw):
|
||||
''' Compile a "2_readme.md" file'''
|
||||
log_obj = BESTLOG(os.path.join(cd, output_filename))
|
||||
main(logger=log_obj,
|
||||
insert_md_section_for__class_methods=insert_md_section_for__class_methods,
|
||||
remove_repeated_sections_classmethods=remove_repeated_sections_classmethods,
|
||||
files_to_include=[0, 1, 2, 3],
|
||||
output_name=OUTPUT_FILENAME,
|
||||
output_name=README_OFILENAME,
|
||||
delete_html_comments=True)
|
||||
log_obj.save()
|
||||
|
||||
# cd = CD = os.path.dirname(os.path.abspath(__file__))
|
||||
# log_file = os.path.join(cd, 'usage.log.txt')
|
||||
return log_obj.load(**kw)
|
||||
|
||||
# if method == 'with logs': compile_all_stuff()
|
||||
def compile_all_stuff(**kw):
|
||||
'''
|
||||
Compile a "2_ and 5_" .md filess
|
||||
return output from them
|
||||
'''
|
||||
result_readme = compile_readme(**kw)
|
||||
result_call_ref = compile_call_ref(**kw)
|
||||
return result_readme, result_call_ref
|
||||
|
||||
|
||||
########################################
|
||||
# _____ #
|
||||
|
@ -216,76 +221,161 @@ def compile_all_stuff(**kw):
|
|||
# | | | | #
|
||||
# |_| |_| #
|
||||
########################################
|
||||
|
||||
def md2psg(target_text):
|
||||
# target = 'This is **bold** and *italic* words'
|
||||
# V
|
||||
# sg.T('This is '), sg.T('bold', font=...bold), ...'
|
||||
|
||||
# imports
|
||||
from collections import namedtuple
|
||||
spec = namedtuple('spec', 'char text'.split(' '))
|
||||
|
||||
# START
|
||||
# =====
|
||||
parts = re.compile(r'([\*]{1,2})([\s\S]*?)([\*]{1,2})', flags=re.M|re.DOTALL).split(target_text)
|
||||
chuncks, skip_this = [], 0
|
||||
for index, part in enumerate(parts):
|
||||
if skip_this != 0:
|
||||
skip_this -= 1; continue
|
||||
|
||||
if part not in ['*', '**']: chuncks.append(part)
|
||||
else:
|
||||
skip_this = 2
|
||||
chuncks.append(spec(part, parts[index+1]))
|
||||
|
||||
font_norm = ('Mono 13 ') # (*sg.DEFAULT_FONT, 'italic')
|
||||
font_bold = ('Mono 13 italic') # (*sg.DEFAULT_FONT, 'italic')
|
||||
font_ita = ('Mono 13 bold') # (*sg.DEFAULT_FONT, 'bold')
|
||||
|
||||
list_of_Ts = []
|
||||
for chunck in chuncks:
|
||||
if type(chunck) is str: list_of_Ts.append(sg.T(chunck, font=font_norm, size=(len(chunck), 1), pad=(0,0)))
|
||||
elif type(chunck) is spec:
|
||||
if chunck.char == '*': list_of_Ts.append(sg.T(chunck.text, font=font_ita, pad=(0,0), size=(len(chunck.text), 1)))
|
||||
if chunck.char == '**': list_of_Ts.append(sg.T(chunck.text, font=font_bold, pad=(0,0), size=(len(chunck.text), 1)))
|
||||
return list_of_Ts
|
||||
|
||||
|
||||
def mini_GUI():
|
||||
my_font = ("Helvetica", 12)
|
||||
my_font2 = ("Helvetica", 12, "bold")
|
||||
my_font3 = ("Helvetica", 15, "bold")
|
||||
my_font4 = ("Mono", 18, "bold")
|
||||
|
||||
|
||||
layout = [
|
||||
[
|
||||
sg.Column(layout=[
|
||||
def make_tab(word):
|
||||
return [[
|
||||
sg.Column(layout=[
|
||||
[sg.T('debug', font=my_font, text_color='blue')],
|
||||
[sg.ML(size=(70-15,20), key='debug')],
|
||||
[sg.ML(size=(70-15, 15), key=f'-{word}-debug-')],
|
||||
[sg.T('error', font=my_font, text_color='red')],
|
||||
[sg.ML(size=(70-15,20), key='error')],
|
||||
])
|
||||
,sg.T(' ')
|
||||
,sg.Column(layout=[
|
||||
[sg.ML(size=(70-15, 15), key=f'-{word}-error-')],
|
||||
]),
|
||||
sg.T(' '), sg.Column(layout=[
|
||||
[sg.T('warning', font=my_font2)],
|
||||
[sg.ML(size=(70-12,20), key='warning')],
|
||||
[sg.ML(size=(70-12, 15), key=f'-{word}-warning-')],
|
||||
[sg.T('info', font=my_font2)],
|
||||
[sg.ML(size=(70-12,20), key='info')],
|
||||
[sg.ML(size=(70-12, 15), key=f'-{word}-info-')],
|
||||
]),
|
||||
sg.Column(layout=[
|
||||
sg.Column(layout=[
|
||||
[sg.T('warning_info', font=my_font3)],
|
||||
[sg.ML(size=(110,42), key='warning_info')],
|
||||
[sg.ML(size=(110, 42-8), key=f'-{word}-warning_info-')],
|
||||
]),
|
||||
|
||||
]]
|
||||
layout = [
|
||||
[ sg.TabGroup( [[
|
||||
sg.Tab('README', make_tab('README')),
|
||||
sg.Tab('CALL_REF', make_tab('CALL_REF'))
|
||||
]]
|
||||
)
|
||||
]
|
||||
]
|
||||
window = sg.Window('We are live! Again! --- ' + 'Completed making {}'.format(OUTPUT_FILENAME), [
|
||||
[sg.T(size=(25,1), font=my_font, key='-compile-time-')]
|
||||
,[
|
||||
|
||||
window = sg.Window('We are live! Again! --- ' + 'Completed making {}, {}'.format(os.path.basename(README_OFILENAME), os.path.basename(CALL_REFERENCE_OFILENAME)), [
|
||||
[sg.T(size=(25,1), font=my_font, key='-compile-time-')],
|
||||
[sg.T(f'The PySimpleGUI module being processed is {sg}')],
|
||||
[
|
||||
sg.B('Run again (F1)', key='-run-')
|
||||
,sg.CB('show time in logs (F2)', False, key='show_time')
|
||||
,sg.CB('Logs with Color (F3)', True, key='use_psg_color')
|
||||
,sg.B('open call ref', key='-open_call_ref-')
|
||||
,sg.B('open readme.txt', key='-open_readme.txt-')
|
||||
,sg.B('open "db folder"', key='-open_db_folder-')
|
||||
,sg.T(' '*30)
|
||||
,sg.Col([
|
||||
# [sg.T('output name for call_ref markdown file', key=(15,1)), sg.I(key='')],
|
||||
[*md2psg('markdown outputFileName *FOR* **readme **: '), sg.I(README_OFILENAME, key='md1'), sg.B('open in explorer', key='open in explorer_readme')],
|
||||
[*md2psg('markdown outputFileName *FOR* **call ref**: '), sg.I(CALL_REFERENCE_OFILENAME, key='md2'), sg.B('open in explorer', key='open in explorer_calref')]
|
||||
])
|
||||
]
|
||||
,*layout
|
||||
], resizable=True, finalize=True, location=(0,0), return_keyboard_events = True)
|
||||
|
||||
def update_time_in_GUI(): window['-compile-time-'](datetime.datetime.today().strftime('%Y-%m-%d %H:%M:%S.%f'))
|
||||
|
||||
def update_compilation_in_psg(values):
|
||||
# get results
|
||||
results = compile_all_stuff(use_psg_color=values['use_psg_color'], show_time=values['show_time'])
|
||||
result_readme, result_call_ref = compile_all_stuff(use_psg_color=values['use_psg_color'], show_time=values['show_time'])
|
||||
|
||||
# UPDATE GUI
|
||||
curr_time = lambda : datetime.datetime.today().strftime('%Y-%m-%d %H:%M:%S.%f')
|
||||
window['-compile-time-'](curr_time())
|
||||
for key, txt in zip('error warning info debug'.split(' '), results[:4]):
|
||||
window[key]('\n'.join(txt))
|
||||
# colors warning_info
|
||||
window['warning_info'].update('')
|
||||
# DO 2_readme
|
||||
window['-README-error-']('\n'.join(result_readme[0]))
|
||||
window['-README-warning-']('\n'.join(result_readme[1]))
|
||||
window['-README-info-']('\n'.join(result_readme[2]))
|
||||
window['-README-debug-']('\n'.join(result_readme[3]))
|
||||
# /// colors warning_info
|
||||
window['-README-warning_info-'].update('')
|
||||
if values['use_psg_color']:
|
||||
for text, color in results[-1]:
|
||||
window['warning_info'].print(text, text_color=color)
|
||||
for text, color in result_readme[-1]:
|
||||
window['-README-warning_info-'].print(text, text_color=color)
|
||||
else:
|
||||
window['warning_info']('\n'.join(results[-1]))
|
||||
window['-README-warning_info-']('\n'.join(result_readme[-1]))
|
||||
|
||||
# DO 5_cal_ref
|
||||
window['-CALL_REF-error-']('\n'.join(result_call_ref[0]))
|
||||
window['-CALL_REF-warning-']('\n'.join(result_call_ref[1]))
|
||||
window['-CALL_REF-info-']('\n'.join(result_call_ref[2]))
|
||||
window['-CALL_REF-debug-']('\n'.join(result_call_ref[3]))
|
||||
# /// colors warning_info
|
||||
window['-CALL_REF-warning_info-'].update('')
|
||||
if values['use_psg_color']:
|
||||
for text, color in result_call_ref[-1]:
|
||||
window['-CALL_REF-warning_info-'].print(text, text_color=color)
|
||||
else:
|
||||
window['-CALL_REF-warning_info-']('\n'.join(result_call_ref[-1]))
|
||||
|
||||
# ~~~~~~~~~~~~
|
||||
# GUI updating
|
||||
# ~~~~~~~~~~~~
|
||||
update_time_in_GUI()
|
||||
|
||||
update_compilation_in_psg({'use_psg_color':not False, 'show_time':False})
|
||||
while True:
|
||||
event, values = window()
|
||||
if event in ('Exit', None): break
|
||||
|
||||
# print(event)
|
||||
if event == '-run-' or 'F1' in event: update_compilation_in_psg(values)
|
||||
# print(values)
|
||||
if event in ('Exit', None):
|
||||
APP_CONFIGS['README_FILENAME'], APP_CONFIGS['CALL_REFERENCE_FILENAME'] = window['md1'].get(), window['md2'].get()
|
||||
save_configs(APP_CONFIGS)
|
||||
break
|
||||
|
||||
print('PSG event>', event)
|
||||
|
||||
# buttons
|
||||
if event == '-run-': update_compilation_in_psg(values)
|
||||
if event == '-open_readme.txt-': openfile(README_OFILENAME)
|
||||
if event == '-open_call_ref-': openfile(CALL_REFERENCE_OFILENAME)
|
||||
if event == '-open_db_folder-': opendir(cd)
|
||||
if event == '-open_github_gallery-': opendir(cd)
|
||||
if event == 'open in explorer_readme': opendir(os.path.dirname(os.path.join(cd, values['md1'])))
|
||||
if event == 'open in explorer_calref': opendir(os.path.dirname(os.path.join(cd, values['md2'])))
|
||||
# hotkeys
|
||||
if 'F1' in event: update_compilation_in_psg(values)
|
||||
if 'F2' in event: window['show_time'](not values['show_time'])
|
||||
if 'F3' in event: window['use_psg_color'](not values['use_psg_color'])
|
||||
|
||||
window.close()
|
||||
|
||||
|
||||
if enable_popup:
|
||||
import PySimpleGUI as sg
|
||||
|
||||
if __name__ == '__main__':
|
||||
mini_GUI()
|
||||
# sg.PopupScrolled('Completed making {}'.format(OUTPUT_FILENAME), ''.join(lines), size=(80,50))
|
||||
# sg.PopupScrolled('Completed making {}'.format(README_OFILENAME), ''.join(lines), size=(80,50))
|
|
@ -1,9 +1,11 @@
|
|||
import PySimpleGUIlib;sg = PySimpleGUIlib
|
||||
import PySimpleGUI as sg
|
||||
import datetime, inspect
|
||||
|
||||
module_to_process = sg
|
||||
|
||||
"""
|
||||
Create All Possible Tags
|
||||
Will output to STDOUT all of the different tags for classes, members and functions for a given PySimpleGUIlib.py
|
||||
Will output to STDOUT all of the different tags for classes, members and functions for a given PySimpleGUI.py
|
||||
file. Functions that begin with _ are filtered out from the list.
|
||||
Displays the results in a PySimpleGUI window which can be used to copy and paste into other places.
|
||||
"""
|
||||
|
@ -27,7 +29,7 @@ def valid_field(pair):
|
|||
|
||||
|
||||
# # ]
|
||||
psg_members = [i for i in inspect.getmembers(PySimpleGUIlib) if valid_field(i)] # ]
|
||||
psg_members = [i for i in inspect.getmembers(module_to_process) if valid_field(i)] # ]
|
||||
psg_funcs = [o[0] for o in psg_members if inspect.isfunction(o[1])] # ] Grabing PSG objects
|
||||
psg_classes = [o for o in psg_members if inspect.isclass(o[1])] # ]
|
||||
# psg_props = [o for o in psg_members if type(o[1]).__name__ == 'property'] # ]
|
||||
|
@ -46,12 +48,12 @@ for aclass in psg_classes:
|
|||
continue
|
||||
|
||||
# print standart things:
|
||||
log(f'### {class_name} Element ')
|
||||
log(f'## {class_name} Element ')
|
||||
log(f'<!-- <+{class_name}.doc+> -->')
|
||||
log(f'<!-- <+{class_name}.__init__+> -->\n')
|
||||
|
||||
# print all public methods:
|
||||
log('\n'.join([f"#### {name}\n<!-- <+{class_name}.{name}+> -->\n"
|
||||
log('\n'.join([f"### {name}\n<!-- <+{class_name}.{name}+> -->\n"
|
||||
for name, obj in inspect.getmembers(aclass)
|
||||
if not name.startswith('_') ]))
|
||||
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
from make_real_readme import main
|
||||
|
||||
########################################################################
|
||||
# __ _ _ #
|
||||
# / _(_) | | #
|
||||
# __ __ ___ ___ _ __ | |_ _ __ _ | |__ ___ _ __ ___ #
|
||||
# \ \ / / / __/ _ \| '_ \| _| |/ _` | | '_ \ / _ \ '__/ _ \ #
|
||||
# \ V / | (_| (_) | | | | | | | (_| | | | | | __/ | | __/ #
|
||||
# \_/ \___\___/|_| |_|_| |_|\__, | |_| |_|\___|_| \___| #
|
||||
# __/ | #
|
||||
# |___/ #
|
||||
########################################################################
|
||||
OUTPUT_FILENAME = 'readme.md'
|
||||
|
||||
##-#-#-# ##-#-#-#
|
||||
# Pre-process logic
|
||||
##-#-#-# ##-#-#-#
|
||||
|
||||
line_break = '<br>'
|
||||
# line_break can be:
|
||||
# - '<br>'
|
||||
# - ' \n '
|
||||
|
||||
method = 'with logs'
|
||||
# method can be:
|
||||
# - 'simple, no log'
|
||||
# - 'with logs'
|
||||
|
||||
|
||||
##-#-#-# ##-#-#-#
|
||||
# Post-process logic
|
||||
##-#-#-# ##-#-#-#
|
||||
enable_popup = True
|
||||
insert_md_section_for__class_methods = False
|
||||
remove_repeated_sections_classmethods = False
|
||||
|
||||
|
||||
|
||||
##############
|
||||
# __ #
|
||||
# /_ | #
|
||||
# | | #
|
||||
# | | #
|
||||
# | | #
|
||||
# |_| #
|
||||
##############
|
||||
if method == 'simple, no log':
|
||||
main(logger=None,
|
||||
insert_md_section_for__class_methods=insert_md_section_for__class_methods,
|
||||
remove_repeated_sections_classmethods=remove_repeated_sections_classmethods,
|
||||
files_to_include=[0, 1, 2, 3],
|
||||
output_name=OUTPUT_FILENAME,
|
||||
delete_html_comments=True)
|
||||
|
||||
################
|
||||
# ___ #
|
||||
# |__ \ #
|
||||
# ) | #
|
||||
# / / #
|
||||
# / /_ #
|
||||
# |____| #
|
||||
################
|
||||
if method == 'with logs':
|
||||
|
||||
import logging
|
||||
logger = logging.getLogger(__name__)
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
my_file = logging.FileHandler('usage.log.txt', mode='w')
|
||||
my_file.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter('%(asctime)s>%(levelname)s: %(message)s')
|
||||
my_file.setFormatter(formatter)
|
||||
logger.addHandler(my_file)
|
||||
logger.info('STARTING')
|
||||
|
||||
main(logger=logger,
|
||||
insert_md_section_for__class_methods=insert_md_section_for__class_methods,
|
||||
remove_repeated_sections_classmethods=remove_repeated_sections_classmethods,
|
||||
files_to_include=[0, 1, 2, 3],
|
||||
output_name=OUTPUT_FILENAME,
|
||||
delete_html_comments=True)
|
||||
|
||||
########################################
|
||||
# _____ #
|
||||
# | __ \ #
|
||||
# | |__) |__ _ __ _ _ _ __ #
|
||||
# | ___/ _ \| '_ \| | | | '_ \ #
|
||||
# | | | (_) | |_) | |_| | |_) | #
|
||||
# |_| \___/| .__/ \__,_| .__/ #
|
||||
# | | | | #
|
||||
# |_| |_| #
|
||||
########################################
|
||||
if enable_popup:
|
||||
import PySimpleGUI as sg
|
||||
|
||||
with open('usage.log.txt', 'r') as ff:
|
||||
lines = ff.read()
|
||||
sg.PopupScrolled('Completed making ' + OUTPUT_FILENAME, lines, size=(80,50))
|
||||
|
||||
|
Loading…
Reference in New Issue