Skip to content
This repository was archived by the owner on Jun 4, 2021. It is now read-only.

Commit bf554f8

Browse files
committed
updated methods in decorators.py.
added pprint_debug to decorators.py.
1 parent 8d97956 commit bf554f8

File tree

9 files changed

+362
-13
lines changed

9 files changed

+362
-13
lines changed

.idea/vcs.xml

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,85 @@
1-
# PyDebug
1+
# PyDebug
2+
3+
debug helper functions
4+
5+
## Getting Started
6+
7+
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
8+
9+
### Prerequisites
10+
11+
What things you need to install the software and how to install them
12+
13+
```
14+
Give examples
15+
```
16+
17+
### Installing
18+
19+
A step by step series of examples that tell you how to get a development env running
20+
21+
Say what the step will be
22+
23+
```
24+
Give the example
25+
```
26+
27+
And repeat
28+
29+
```
30+
until finished
31+
```
32+
33+
End with an example of getting some data out of the system or using it for a little demo
34+
35+
## Running the tests
36+
37+
Explain how to run the automated tests for this system
38+
39+
### Break down into end to end tests
40+
41+
Explain what these tests test and why
42+
43+
```
44+
Give an example
45+
```
46+
47+
### And coding style tests
48+
49+
Explain what these tests test and why
50+
51+
```
52+
Give an example
53+
```
54+
55+
## Deployment
56+
57+
Add additional notes about how to deploy this on a live system
58+
59+
## Built With
60+
61+
*
62+
63+
## Object Structure
64+
65+
Please read [object_structure.json](https://github.com/Jakar510/PythonTkinterBindings/blob/master/src/object_struture.json) for details on the structure.
66+
67+
## Contributing
68+
69+
Please read [CONTRIBUTING.md]() for details on our code of conduct, and the process for submitting pull requests to us.
70+
71+
## Authors
72+
73+
* **Tyler Stegmaier** - *Initial work* - [Jakar510](https://github.com/Jakar510)
74+
75+
See also the list of [contributors](https://github.com/your/project/contributors) who participated in this project.
76+
77+
## License
78+
79+
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
80+
81+
## Acknowledgments
82+
83+
* Hat tip to anyone whose code was used
84+
* Inspiration
85+
* etc

install.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cd D:\WorkSpace\PyDebug>
2+
3+
python setup.py build sdist
4+
5+
python setup.py install
6+
7+
pause

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from setuptools import setup
2-
from src.PyDebug.__version__ import version
2+
from src.PyDebug import version
33

44

55

@@ -15,7 +15,7 @@
1515
license='GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007',
1616
author='Tyler Stegmaier',
1717
author_email='tyler.stegmaier.510@gmail.com',
18-
description='A pure python way to efficiently do a c++ style switch case in Python 3.6+.',
18+
description='A set of helpers for debugging Python 3.x.',
1919
install_requires=[],
2020
classifiers=[
2121
# How mature is this project? Common values are

src/PyDebug/TkinterThemes.jpg

2.06 MB
Loading

src/PyDebug/__init__.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
1+
import sys
2+
13
from .converters import *
24
from .console import *
35
from .decorators import *
6+
from .colors import *
7+
from .__version__ import *
48

5-
__all__ = ['PRINT', 'getPPrintStr', 'debug', 'IsAttributePrivate', 'ObjectToDict']
69

10+
def get_size(obj, seen=None):
11+
"""Recursively finds size of objects"""
12+
size = sys.getsizeof(obj)
13+
if seen is None:
14+
seen = set()
15+
obj_id = id(obj)
16+
if obj_id in seen:
17+
return 0
18+
# Important mark as seen *before* entering recursion to gracefully handle
19+
# self-referential objects
20+
seen.add(obj_id)
21+
if isinstance(obj, dict):
22+
size += sum([get_size(v, seen) for v in obj.values()])
23+
size += sum([get_size(k, seen) for k in obj.keys()])
24+
elif hasattr(obj, '__dict__'):
25+
size += get_size(obj.__dict__, seen)
26+
elif hasattr(obj, '__iter__') and not isinstance(obj, (str, bytes, bytearray)):
27+
size += sum([get_size(i, seen) for i in obj])
28+
return size

src/PyDebug/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11

22

3-
version = '1.0.0'
3+
version = '1.1.0'

src/PyDebug/colors.py

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import tkinter as tk
2+
3+
class AllNamedColors(object):
4+
all_widgets = []
5+
COLORS = [
6+
'snow', 'ghost white', 'white smoke', 'gainsboro', 'floral white', 'old lace',
7+
'linen', 'antique white', 'papaya whip', 'blanched almond', 'bisque', 'peach puff',
8+
'navajo white', 'lemon chiffon', 'mint cream', 'azure', 'alice blue', 'lavender',
9+
'lavender blush', 'misty rose', 'dark slate gray', 'dim gray', 'slate gray',
10+
'light slate gray', 'gray', 'light grey', 'midnight blue', 'navy', 'cornflower blue', 'dark slate blue',
11+
'slate blue', 'medium slate blue', 'light slate blue', 'medium blue', 'royal blue', 'blue',
12+
'dodger blue', 'deep sky blue', 'sky blue', 'light sky blue', 'steel blue', 'light steel blue',
13+
'light blue', 'powder blue', 'pale turquoise', 'dark turquoise', 'medium turquoise', 'turquoise',
14+
'cyan', 'light cyan', 'cadet blue', 'medium aquamarine', 'aquamarine', 'dark green', 'dark olive green',
15+
'dark sea green', 'sea green', 'medium sea green', 'light sea green', 'pale green', 'spring green',
16+
'lawn green', 'medium spring green', 'green yellow', 'lime green', 'yellow green',
17+
'forest green', 'olive drab', 'dark khaki', 'khaki', 'pale goldenrod', 'light goldenrod yellow',
18+
'light yellow', 'yellow', 'gold', 'light goldenrod', 'goldenrod', 'dark goldenrod', 'rosy brown',
19+
'indian red', 'saddle brown', 'sandy brown',
20+
'dark salmon', 'salmon', 'light salmon', 'orange', 'dark orange',
21+
'coral', 'light coral', 'tomato', 'orange red', 'red', 'hot pink', 'deep pink', 'pink', 'light pink',
22+
'pale violet red', 'maroon', 'medium violet red', 'violet red',
23+
'medium orchid', 'dark orchid', 'dark violet', 'blue violet', 'purple', 'medium purple',
24+
'thistle', 'snow2', 'snow3',
25+
'snow4', 'seashell2', 'seashell3', 'seashell4', 'AntiqueWhite1', 'AntiqueWhite2',
26+
'AntiqueWhite3', 'AntiqueWhite4', 'bisque2', 'bisque3', 'bisque4', 'PeachPuff2',
27+
'PeachPuff3', 'PeachPuff4', 'NavajoWhite2', 'NavajoWhite3', 'NavajoWhite4',
28+
'LemonChiffon2', 'LemonChiffon3', 'LemonChiffon4', 'cornsilk2', 'cornsilk3',
29+
'cornsilk4', 'ivory2', 'ivory3', 'ivory4', 'honeydew2', 'honeydew3', 'honeydew4',
30+
'LavenderBlush2', 'LavenderBlush3', 'LavenderBlush4', 'MistyRose2', 'MistyRose3',
31+
'MistyRose4', 'azure2', 'azure3', 'azure4', 'SlateBlue1', 'SlateBlue2', 'SlateBlue3',
32+
'SlateBlue4', 'RoyalBlue1', 'RoyalBlue2', 'RoyalBlue3', 'RoyalBlue4', 'blue2', 'blue4',
33+
'DodgerBlue2', 'DodgerBlue3', 'DodgerBlue4', 'SteelBlue1', 'SteelBlue2',
34+
'SteelBlue3', 'SteelBlue4', 'DeepSkyBlue2', 'DeepSkyBlue3', 'DeepSkyBlue4',
35+
'SkyBlue1', 'SkyBlue2', 'SkyBlue3', 'SkyBlue4', 'LightSkyBlue1', 'LightSkyBlue2',
36+
'LightSkyBlue3', 'LightSkyBlue4', 'SlateGray1', 'SlateGray2', 'SlateGray3',
37+
'SlateGray4', 'LightSteelBlue1', 'LightSteelBlue2', 'LightSteelBlue3',
38+
'LightSteelBlue4', 'LightBlue1', 'LightBlue2', 'LightBlue3', 'LightBlue4',
39+
'LightCyan2', 'LightCyan3', 'LightCyan4', 'PaleTurquoise1', 'PaleTurquoise2',
40+
'PaleTurquoise3', 'PaleTurquoise4', 'CadetBlue1', 'CadetBlue2', 'CadetBlue3',
41+
'CadetBlue4', 'turquoise1', 'turquoise2', 'turquoise3', 'turquoise4', 'cyan2', 'cyan3',
42+
'cyan4', 'DarkSlateGray1', 'DarkSlateGray2', 'DarkSlateGray3', 'DarkSlateGray4',
43+
'aquamarine2', 'aquamarine4', 'DarkSeaGreen1', 'DarkSeaGreen2', 'DarkSeaGreen3',
44+
'DarkSeaGreen4', 'SeaGreen1', 'SeaGreen2', 'SeaGreen3', 'PaleGreen1', 'PaleGreen2',
45+
'PaleGreen3', 'PaleGreen4', 'SpringGreen2', 'SpringGreen3', 'SpringGreen4',
46+
'green2', 'green3', 'green4', 'chartreuse2', 'chartreuse3', 'chartreuse4',
47+
'OliveDrab1', 'OliveDrab2', 'OliveDrab4', 'DarkOliveGreen1', 'DarkOliveGreen2',
48+
'DarkOliveGreen3', 'DarkOliveGreen4', 'khaki1', 'khaki2', 'khaki3', 'khaki4',
49+
'LightGoldenrod1', 'LightGoldenrod2', 'LightGoldenrod3', 'LightGoldenrod4',
50+
'LightYellow2', 'LightYellow3', 'LightYellow4', 'yellow2', 'yellow3', 'yellow4',
51+
'gold2', 'gold3', 'gold4', 'goldenrod1', 'goldenrod2', 'goldenrod3', 'goldenrod4',
52+
'DarkGoldenrod1', 'DarkGoldenrod2', 'DarkGoldenrod3', 'DarkGoldenrod4',
53+
'RosyBrown1', 'RosyBrown2', 'RosyBrown3', 'RosyBrown4', 'IndianRed1', 'IndianRed2',
54+
'IndianRed3', 'IndianRed4', 'sienna1', 'sienna2', 'sienna3', 'sienna4', 'burlywood1',
55+
'burlywood2', 'burlywood3', 'burlywood4', 'wheat1', 'wheat2', 'wheat3', 'wheat4', 'tan1',
56+
'tan2', 'tan4', 'chocolate1', 'chocolate2', 'chocolate3', 'firebrick1', 'firebrick2',
57+
'firebrick3', 'firebrick4', 'brown1', 'brown2', 'brown3', 'brown4', 'salmon1', 'salmon2',
58+
'salmon3', 'salmon4', 'LightSalmon2', 'LightSalmon3', 'LightSalmon4', 'orange2',
59+
'orange3', 'orange4', 'DarkOrange1', 'DarkOrange2', 'DarkOrange3', 'DarkOrange4',
60+
'coral1', 'coral2', 'coral3', 'coral4', 'tomato2', 'tomato3', 'tomato4', 'OrangeRed2',
61+
'OrangeRed3', 'OrangeRed4', 'red2', 'red3', 'red4', 'DeepPink2', 'DeepPink3', 'DeepPink4',
62+
'HotPink1', 'HotPink2', 'HotPink3', 'HotPink4', 'pink1', 'pink2', 'pink3', 'pink4',
63+
'LightPink1', 'LightPink2', 'LightPink3', 'LightPink4', 'PaleVioletRed1',
64+
'PaleVioletRed2', 'PaleVioletRed3', 'PaleVioletRed4', 'maroon1', 'maroon2',
65+
'maroon3', 'maroon4', 'VioletRed1', 'VioletRed2', 'VioletRed3', 'VioletRed4',
66+
'magenta2', 'magenta3', 'magenta4', 'orchid1', 'orchid2', 'orchid3', 'orchid4', 'plum1',
67+
'plum2', 'plum3', 'plum4', 'MediumOrchid1', 'MediumOrchid2', 'MediumOrchid3',
68+
'MediumOrchid4', 'DarkOrchid1', 'DarkOrchid2', 'DarkOrchid3', 'DarkOrchid4',
69+
'purple1', 'purple2', 'purple3', 'purple4', 'MediumPurple1', 'MediumPurple2',
70+
'MediumPurple3', 'MediumPurple4', 'thistle1', 'thistle2', 'thistle3', 'thistle4',
71+
'gray1', 'gray2', 'gray3', 'gray4', 'gray5', 'gray6', 'gray7', 'gray8', 'gray9', 'gray10',
72+
'gray11', 'gray12', 'gray13', 'gray14', 'gray15', 'gray16', 'gray17', 'gray18', 'gray19',
73+
'gray20', 'gray21', 'gray22', 'gray23', 'gray24', 'gray25', 'gray26', 'gray27', 'gray28',
74+
'gray29', 'gray30', 'gray31', 'gray32', 'gray33', 'gray34', 'gray35', 'gray36', 'gray37',
75+
'gray38', 'gray39', 'gray40', 'gray42', 'gray43', 'gray44', 'gray45', 'gray46', 'gray47',
76+
'gray48', 'gray49', 'gray50', 'gray51', 'gray52', 'gray53', 'gray54', 'gray55', 'gray56',
77+
'gray57', 'gray58', 'gray59', 'gray60', 'gray61', 'gray62', 'gray63', 'gray64', 'gray65',
78+
'gray66', 'gray67', 'gray68', 'gray69', 'gray70', 'gray71', 'gray72', 'gray73', 'gray74',
79+
'gray75', 'gray76', 'gray77', 'gray78', 'gray79', 'gray80', 'gray81', 'gray82', 'gray83',
80+
'gray84', 'gray85', 'gray86', 'gray87', 'gray88', 'gray89', 'gray90', 'gray91', 'gray92',
81+
'gray93', 'gray94', 'gray95', 'gray97', 'gray98', 'gray99'
82+
]
83+
def __init__(self, MAX_ROWS: int = 36, FONT_SIZE: int = 10):
84+
self.root = tk.Tk()
85+
self.root.title("Named colour chart")
86+
87+
self.frame = tk.Frame(self.root)
88+
self.frame.pack(fill=tk.BOTH, expand=True)
89+
90+
row = 0
91+
col = 0
92+
for color in self.COLORS:
93+
self.frame.grid_rowconfigure(row, weight=1)
94+
self.frame.grid_columnconfigure(col, weight=1)
95+
96+
l = tk.Label(self.frame, text=color, background=color, font=(None, -FONT_SIZE))
97+
l.grid(row=row, column=col, sticky=tk.NSEW)
98+
self.all_widgets.append(l)
99+
row += 1
100+
if row > MAX_ROWS:
101+
row = 0
102+
col += 1
103+
104+
def run(self):
105+
self.root.mainloop()
106+
107+
def runTkColors():
108+
Colors = AllNamedColors()
109+
Colors.run()
110+
111+
if __name__ == '__main__':
112+
runTkColors()

0 commit comments

Comments
 (0)