Comments (1)
You could use Pillow, something like this:
from PIL import Image, ImageDraw, ImageFont
from prettytable import PrettyTable
table = PrettyTable()
table.field_names = ["City name", "Area", "Population", "Annual Rainfall"]
table.add_row(["Adelaide", 1295, 1158259, 600.5])
table.add_row(["Brisbane", 5905, 1857594, 1146.4])
table.add_row(["Darwin", 112, 120900, 1714.7])
table.add_row(["Hobart", 1357, 205556, 619.5])
table.add_row(["Sydney", 2058, 4336374, 1214.8])
table.add_row(["Melbourne", 1566, 3806092, 646.9])
table.add_row(["Perth", 5386, 1554769, 869.4])
im = Image.new("RGB", (500, 200), "white")
draw = ImageDraw.Draw(im)
font = ImageFont.truetype("FreeMono.ttf", 15)
draw.text((10, 10), str(table), font=font, fill="black")
im.show()
im.save("table.png")
from prettytable.
Related Issues (20)
- Support for rich colored cell data HOT 2
- Support displaying selected fields for CSV format
- Pretty printing inside cloudwatch logs HOT 1
- Is max_width word-wrapping configurable? HOT 10
- PrettyTable.add_rows method support divider Argument
- Calculate column width HOT 4
- Full-width characters cannot be wrapped correctly. HOT 2
- can you add an option for the divider, so insted of add the divider below it add its above?
- Negative Integer and Float in Red and positive in Green
- argument max_width doesn't work
- 3.10.0: pytest fails because incorrect module name HOT 2
- max_table_width does not work as expected HOT 7
- Colortable with title leads to broken layout HOT 6
- Add color to field names HOT 4
- Print table failed when I created a copy.py in the same directory with my other python files. HOT 1
- Markdown tables with narrow columns don't render
- Mediawiki Output
- Cannot release from Jazzband to PyPI HOT 3
- `float_format` not working HOT 1
- `float_format` not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prettytable.