An all in one library for python
Project description
pip install tailwindall
[!IMPORTANT] A python all in one package for doing everything, including:
- Graphing
- UI
- Website development
- Statistics
- Maths
- Shape identification
- Angle calculation
- And more!
[!NOTE]
Future Updates
- [ ] Add widgets
- [ ] For web development
- [ ] For UI development
- [ ] Add different types of graphs
- [ ] Add more statistics functions
- [ ] Add more math functions
- [ ] Add more util functions
- [ ] Improve syntax of tw script
- [ ] Improve networking library
- [ ] Add embedded pygame/turtle windows for graphics
- [x] Add multiple windows rendering at once
- [x] Add shape identification
- [x] Add angle calculation
- [x] Add scenes for graphics
- [x] Add gameobjects
- [x] Finished shape identification
- [ ] Add more documentation
[!WARNING] Math/Web module is not finished yet
Usage
Window
tailwindall.window
class Window:
def __init__(self, style, name, options={}):
def main_loop(self):
def add_widget(self, widget: any, options={}):
def __call__(self, *args, **kwargs):
def quit(self):
def add_on_exit_function(self, func):
def remove_on_exit_function(self, func):
def add_garbage_collect_path(self, path):
def remove_garbage_collect_path(self, path):
def __init__(style, name, options)
You pass in a style (can be file or a string)
If you choose to pass in a file use style = "path/to/file"
The file and string must be in the format
.class-name {key:value;key2:value2;}
tag {key:value;key2:value2;}
def main_loop()
Runs the main loop. Any code after this will not be executed. Use add_on_exit_function(func)
to add a function to be called when the window is closed.
def add_widget(widget: any, options={})
Use the function to add a widget to the window, a base options file will be as follows:
{
"place": {
"relx": 0,
"rely": 0,
"anchor": util.CenterAnchor().get_anchor()
}
}
Keep in mind you will have to import tailwindall.util
and tailwindall.widgets
def __call__(self, *args, **kwargs)
Returns the window._ctk
private attribute. This is only for the backend but you may use it for creating your own widgets with tailwindall.widget.Widget()
def quit(self)
Does garbage collection of files created when graphs are rendered. Add your own files to this list using add_garbage_collect_path(self, path)
to add a path to the garbage collection
def add_on_exit_function(self, func)
Adds an on exit function to the list, this function will be called on the closing of the window.
def remove_on_exit_function(self, func)
Removes an on exit function from the list NOT RECOMMENDED
def add_garbage_collect_path(self, path)
Add your own garbage collection path to be deleted on window close
def remove_garbage_collect_path(self, path)
Remove garbage collect path NOT RECOMMENDED
Graphing
tailwindall.graphing
These are the acceptable types of graphs to be put in the GraphOptions.type
parameter.
Graph Options
class GraphOptions:
def __init__(self, xLabel, yLabel, title, size: util.ImageScale, type: str):
Graph options take in:
xLabel
(a label for the x axis)yLabel
(a label for the y axis)title
a title for the graphsize
autil.ImageScale
objecttype
a string containing the type of graph. Must be inGRAPH_TYPES
def display(self)
The display function creates a graph and returns an widgets.Image
object that can be directly added to a tailwindall.window.Window
using window.add_widget(widget)
Line Graph
tailwindall.graphing.LineGraph
class LineGraph(Graph):
def __init__(self, xData, yData, options: GraphOptions, window):
def display(self):
Used to create line graphs. display()
returns a widget to render on the screen
Bar Graph
tailwindall.graphing.BarGraph
class BarGraph(Graph):
def __init__(self, xData, yData, options: GraphOptions, window):
def display(self):
Used to create bar graphs. display()
returns a widget to render on the screen
Pie Graph
tailwindall.graphing.PieGraph
class PieGraph(Graph):
def __init__(self, xData, yData, options: GraphOptions, window):
def display(self):
Used to create pie graphs. display()
returns a widget to render on the screen
Scatter Graph
tailwindall.graphing.ScatterGraph
class ScatterGraph(Graph):
def __init__(self, xData, yData, options: GraphOptions, window):
def display(self):
Used to create scatter graphs. display()
returns a widget to render on the screen
Histogram Graph
tailwindall.graphing.HistogramGraph
class HistogramGraph(Graph):
def __init__(self, xData, yData, options: GraphOptions, window):
def display(self):
Used to create histogram graphs. display()
returns a widget to render on the screen
Box Plot Graph
tailwindall.graphing.BoxPlotGraph
class BoxPlotGraph(Graph):
def __init__(self, xData, yData, options: GraphOptions, window):
def display(self):
Used to create box plot graphs. display()
returns a widget to render on the screen
Area Graph
tailwindall.graphing.AreaGraph
class AreaGraph(Graph):
def __init__(self, xData, yData, options: GraphOptions, window):
def display(self):
Used to create area graphs. display()
returns a widget to render on the screen
Statistics
tailwindall.statistics_lib.statistics
Mean
tailwindall.statistics_lib.statistics.mean(data)
Returns the mean of the data
Median
tailwindall.statistics_lib.statistics.median(data)
Returns the median of the data
Mode
tailwindall.statistics_lib.statistics.mode(data)
Returns the mode of the data
Range
tailwindall.statistics_lib.statistics.range(data)
Returns the range of the data
Standard Deviation
tailwindall.statistics_lib.statistics.standard_deviation(data)
Returns the standard deviation of the data
Variance
tailwindall.statistics_lib.statistics.variance(data)
Returns the variance of the data
Quartiles
tailwindall.statistics_lib.statistics.quartiles(data)
Returns the quartiles of the data
Interquartile Range
tailwindall.statistics_lib.statistics.interquartile_range(data)
Returns the interquartile range of the data
Z-Score
tailwindall.statistics_lib.statistics.z_score(data)
Returns the z-score of the data
Z-Scores
tailwindall.statistics_lib.statistics.z_scores(data)
Returns the z-scores of the data
Percentile
tailwindall.statistics_lib.statistics.percentile(data, percentile)
Returns the percentile of the data
Outliers
tailwindall.statistics_lib.statistics.outliers(data)
Returns the outliers of the data
Remove Outliers
tailwindall.statistics_lib.statistics.remove_outliers(data)
Returns the data with the outliers removed
Covariance
tailwindall.statistics_lib.statistics.covariance(data1, data2)
Returns the covariance of the data
Correlation
tailwindall.statistics_lib.statistics.correlation(data1, data2)
Returns the correlation of the data
Least Squares Regression
tailwindall.statistics_lib.statistics.least_squares_regression(data1, data2)
Returns the least squares regression of the data
Least Squares Regression Line
tailwindall.statistics_lib.statistics.least_squares_regression_line(data1, data2)
Returns the least squares regression line of the data
Util
tailwindall.util
Constants
NULL = None
null = NULL
These are used to create a more diverse usage of null types.
Type Utilities
tailwindall.util.Types
def are_list_items_same(cls, this: list, other: list):
@classmethod
Can be called using tailwindall.util.Types.are_list_items_same(this, other)
depending on how you import it. You pass in two lists and the function will return a list telling you if the item in the same index in each list are the same type.
def is_class_same(cls, this: object, other: object):
@classmethod
Can be called using tailwindall.util.Types.is_class_same
. It takes in two objects and outputs wheather each attribute in each object is the same and if it is not in the other object it outputs None
. The return value is a dictionary containing all the attribute names from each object as keys and if the are the same between objects as the value.
def is_type(cls, this, other):
@classmethod
Can be called using tailwindall.util.Types.is_type
. Takes in two arguments this
and other
and returns weather they are the same object type.
File Utilities
tailwindall.util
def read_file(file, options={}):
Reads a file and returns contents. options
allow for the user to input {"strip": True}
to strip the lines before returning and {"lines": True}
to return the value of readlines.
The only other argument is file
which is the path to the file that you are trying to read.
Anchor Points
tailwindall.util
General
To access the anchor for use with placing widgets use anchor_class.get_anchor()
. get_anchor()
is a class method allowing it to be called without it's respective object needing to be instantiated.
Current Types
The current anchors are as follows:
EmptyAnchor
CenterAnchor
NorthAnchor
NorthEastAnchor
EastAnchor
SouthEastAnchor
SouthAnchor
WestAnchor
NorthWestAnchor
Image Scale
tailwindall.util.ImageScale(width, height)
Takes in a width and a height and returns it when called (image_scale()
)
Other
Execute List
tailwindall.util.exec_list(functions, final=None):
Takes in a list of functions and a final function to be called (not required)
It executes each function in the list before finishing with the final function.
Widgets
tailwindall.widgets
Button
tailwindall.widgets.Button
def __init__(self, window, style={}, properties={}, binds={}, **kwargs)
Takes in the arguments window
which is a tailwindall.window.Window
, an object that contains the styles that will be applied to the object. The keys are the property and the values are the new value. Properties work the same and binds take in the event as the key and the function that is called as the value. If text is a property it will be set as the text in the button.
Returns a button that can be rendered onto the screen using window.add_widget(widget)
Label
tailwindall.widgets.Label
def __init__(self, window, style={}, properties={}, binds={}, **kwargs):
Takes in the arguments window
which is a tailwindall.window.Window
, an object that contains the styles that will be applied to the object. The keys are the property and the values are the new value. Properties work the same and binds take in the event as the key and the function that is called as the value. If text is a property it will be set as the text in the label.
Returns a label that can be rendered onto the screen using window.add_widget(widget)
Entry
tailwindall.widgets.Entry
def __init__(self, window, style={}, properties={}, binds={}, **kwargs):
Takes in the arguments window
which is a tailwindall.window.Window
, an object that contains the styles that will be applied to the object. The keys are the property and the values are the new value. Properties work the same and binds take in the event as the key and the function that is called as the value. If text is a property it will be set as the text in the entry.
Returns an entry that can be rendered onto the screen using window.add_widget(widget)
Frame
tailwindall.widgets.Frame
def __init__(self, window, style={}, properties={}, binds={}, **kwargs):
Takes in the arguments window
which is a tailwindall.window.Window
, an object that contains the styles that will be applied to the object. The keys are the property and the values are the new value. Properties work the same and binds take in the event as the key and the function that is called as the value.
Returns a frame that can be rendered onto the screen using window.add_widget(widget)
Canvas
tailwindall.widgets.Canvas
def __init__(self, window, style={}, properties={}, binds={}, **kwargs):
Takes in the arguments window
which is a tailwindall.window.Window
, an object that contains the styles that will be applied to the object. The keys are the property and the values are the new value. Properties work the same and binds take in the event as the key and the function that is called as the value.
Returns a canvas that can be rendered onto the screen using window.add_widget(widget)
Scrollbar
tailwindall.widgets.Scrollbar
def __init__(self, window, style={}, properties={}, binds={}, **kwargs):
Takes in the arguments window
which is a tailwindall.window.Window
, an object that contains the styles that will be applied to the object. The keys are the property and the values are the new value. Properties work the same and binds take in the event as the key and the function that is called as the value.
Returns a scrollbar that can be rendered onto the screen using window.add_widget(widget)
Scrollview
tailwindall.widgets.Scrollview
def __init__(self, window, style={}, properties={}, binds={}, **kwargs):
Takes in the arguments window
which is a tailwindall.window.Window
, an object that contains the styles that will be applied to the object. The keys are the property and the values are the new value. Properties work the same and binds take in the event as the key and the function that is called as the value.
Returns a scrollview that can be rendered onto the screen using window.add_widget(widget)
'
Image
tailwindall.widgets.Image
def __init__(self, window, image, style={}, properties={}, binds={}, **kwargs):
Takes in the arguments window
which is a tailwindall.window.Window
, an object that contains the styles that will be applied to the object. The keys are the property and the values are the new value. Properties work the same and binds take in the event as the key and the function that is called as the value. Image
is the path to the image to be rendered.
Returns an image that can be rendered onto the screen using window.add_widget(widget)
Developer
Widget
tailwindall.widget.Widget
def __init__(self, style, properties, binds, _ctk):
Takes in style
, properties
, binds
and a _ctk
(an object that can actually be rendered onto the screen with styles).
It has no public methods other then reload_styles()
, reload_properties()
and reload_binds()
. These are all called on creation so they should generally have no reason to be called again.
Styles
tailwindall.styles.Styles
def parse(cls, style: str, file=False)
@classmethod
Parses a css (style) string or file into an object containing classnames, ids and tags each containing the respective properties.
Graphing
Graph Class
class Graph:
def __init__(self):
def display(self):
Create a figure under the property of self.graph
and inherit from this class for creating new graphs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tailwindall-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb69366b097c4bf455531d93eabdc86fbf75a2fa03e93f8d764a32d5ee0a62ec |
|
MD5 | 7842818c1a7faf16f1357f7b74bf3d00 |
|
BLAKE2b-256 | 36fcc62c61a959a46cedcf05c28ad50ec6a861a9bb7e5d2189813eed7a8b343d |