I am drawing a table using tKinter. I was wondering if there was a way to export the table as an image.
for r in range(numberOfRows):
开发者_StackOverflow for c in range(numberOfColumns):
l = tk.Label(root, text=someText, relief="solid", height=5, width=10, bg="white")
l.grid(row=r, column=c)
Thanks.
You can always go the draw-it-yourself way. There are several modules out there that allow you draw an image. Take the coordinates of your table, column width and so on and draw it into the image.
You can take a screen shot of it.
import PIL.ImageGrab as ImageGrab
screenshot = ImageGrab.grab().load()
rgb = screenshot[0, 0]
print rgb
rgb would return the color value of any pixel on screen.
精彩评论