Easy way to make documents with gui (tkinter)
Project description
PyDocument
Easy way to make a document with gui (tkinter)
Installing
Here is a simple way to install:
pip install pydocument
Here is a simple way to upgrade the package to the newest version:
pip install pydocument --upgrade
Example
from pydocument import Document, ARIALBOLD
document = Document(1000, 900, "Hello World")
document.add_text("Hello World", ARIALBOLD)
document.add_space() # document.add_newline() also works
document.add_text("""
Hello world.. With PyDocument here, we can make such great documents..
PyDocument is so simple, and so small.. It's really easy to make documents
using PyDocument. It's really fun as well!
""")
document.start()
Documentation
- Classes
- Document
Document
Object
Creates new Document object
Note: All arguments are optional, so for example, the width will always be 200 unless you change it.
Parameters
- width (Integer) = 200
- height (Integer) = 200
- title (String) = "pydocument"
- bg (String) = "white"
Returns
- Object
Example
Document(500, 500, "Hello Title", "gray")
Example on changing specific argument
Document(height=500, bg="gray")
Properties
- app (Tkinter) - The document / window you created.
- width (Integer) - The current width of the document / window.
- height (Integer) - The current height of the document / window.
- bg (String) - The background color of the document / window.
Methods
- start
- set_title
- disable_maximize
- enable_maximize
- change_width
- change_height
- change_size
- add_text
- add_arial_text
- add_arial_bold_text
- add_space / add_newline
start
Starts the application / document (mainloop of tkinter)
Parameters
None
Returns
None
Example
.start()
set_title
Sets the title of the application / document
Parameters
- title (String)
Returns
None
Example
.set_title("Hello Title")
disable_maximize
Disables the user from maximizing the window
Parameters
None
Returns
None
Example
.disable_maximize()
enable_maximize
Enables the user from maximizing the window
Parameters
None
Returns
None
Example
.enable_maximize()
change_width
Changes the width of the window
Parameters
- width (Integer)
Returns
None
Example
.change_width(500)
change_height
Changes the height of the window
Parameters
- height (Integer)
Returns
None
Example
.change_height(500)
change_size
Changes the size of the window
Parameters
- width (Integer)
- height (Integer)
Returns
None
Example
.change_size(500, 500)
add_text
Adds text to the application / document
Note: Arguments 'font', 'font_size', and 'bg' are optional
Parameters
- text (String)
- font (String) = "Arial"
- font_size (Integer) = 20
- bg (String) = None
Returns
None
Example
.add_text("Hello Text", "Arial Bold", 25, "gray")
Example on changing specific argument
.add_text("Hello Text", font_size=15)
add_arial_text
Adds arial font text to the application / document
Note: Arguments 'font_size' and 'bg' are optional
Parameters
- text (String)
- font_size (Integer) = 20
- bg (String) = None
Returns
None
Example
.add_arial_text("Hello Text", 25, "gray")
Example on changing specific argument
.add_arial_text("Hello Text", bg="gray")
add_arial_bold_text
Adds arial bold font text to the application / document
Note: Arguments 'font_size' and 'bg' are optional
Parameters
- text (String)
- font_size (Integer) = 20
- bg (String) = None
Returns
None
Example
.add_arial_bold_text("Hello Text", 25, "gray")
Example on changing specific argument
.add_arial_bold_text("Hello Text", bg="gray")
add_space
Adds a space to the application / document
Note: Arguments 'spaces' and 'bg' are optional
Parameters
- spaces (Integer) = 1
- bg (String) = None
Returns
None
Example
.add_space(3, "gray")
Example on changing specific argument
.add_space(bg="gray")
add_newline
Same thing as add_space
.
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
File details
Details for the file pydocument-1.0.tar.gz
.
File metadata
- Download URL: pydocument-1.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff24eaa666d09c05c24bb49de9607f108acfba1675e88a8926855c44b0fafa53 |
|
MD5 | 5a895869cd221c30b743945163374394 |
|
BLAKE2b-256 | c80206f458214a97bce8e9c84f0d42779e4da2f4e9a0bbedeacecbd8d83f7de8 |