Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_graphchart.py
- from Tkinter import *
- import random
- root = Tk()
- cw = 650
- ch = 500
- c = Canvas(width=cw, height=ch, background="white")
- c.pack()
- c.create_line(10, ch, cw, ch)
- c.create_line(10, 0, 10, ch)
- for a, b in zip(range(100, ch, 100), range(100, 0, -25)):
- c.create_line(0, a, 20, a)
- c.create_text(30, a, text=str(b))
- x = 50
- y = 70
- bars = [random.randint(1, 100) for i in range(12)]
- limit = x * len(bars)
- while x <= limit:
- for i in bars:
- c.create_rectangle(x, ch-(i*4),
- y, ch,
- outline="black",
- fill="royalblue")
- x += 50
- y += 50
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement