Extra objects for the graphics.py package
Project description
graphics.py-extra
This package provides greater possibilities for drawing shapes with the graphics.py package.
The included graphics objects are:
RoundedRectangle (a rectangle with rounded corners)
FreeText (write text without font limitations)
(Portuguese)
Esse pacote fornece mais formas para se desenhar com o pacote graphics.py.
Os objetos gráficos incluídos são:
RoundedRectangle (um retângulo com os cantos arredondados)
FreeText (desenhar texto sem limites sobre a fonte usada)
Examples/Exemplos
Example 1: Drawing a rounded rectangle.
import graphics
from graphics_extra import RoundedRectangle
win = graphics.GraphWin('Example for RoundedRectangle', 400, 300)
rect = RoundedRectangle(
graphics.Point(50, 50),
graphics.Point(350, 250),
radius=100
)
rect.setFill('light sky blue')
rect.draw(win)
Example 2: Writing text with a custom font face.
import graphics
import tkinter.font
from graphics_extra import FreeText
win = graphics.GraphWin('Example for FreeText', 400, 300)
open_sans_font = tkinter.font.Font(family='Open Sans', weight='normal', size=46)
txt = FreeText(graphics.Point(200, 150), 'Lorem ipsum', open_sans_font)
# txt.setAlignment('SW') # (the default in FreeText)
txt.setAlignment('CENTER') # (the default in graphics.Text)
# Show the space that the text will take up
print('Text width:', txt.getWidth(win))
print('Text height:', txt.getHeight(win))
txt.draw(win)
Project details
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 graphics.py-extra-0.0.4.tar.gz.
File metadata
- Download URL: graphics.py-extra-0.0.4.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e628e2a042019d08a5b3bd73f31852d751c58a0f4fe518534dbee328f593c1c
|
|
| MD5 |
252a5f290485ad0dd17f0dd235a6f220
|
|
| BLAKE2b-256 |
6efeb13a72a045119ec70ff32a5c208f913572d6073369b304761866a9520776
|