Skip to content

Commit

Permalink
Create draw_text.py
Browse files Browse the repository at this point in the history
  • Loading branch information
janbodnar committed Apr 19, 2019
1 parent 7b83ebb commit c940d44
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions drawing/draw_text.py
@@ -0,0 +1,54 @@
#!/usr/bin/env python3

"""
ZetCode Tkinter tutorial
In this script, we draw text
on the window.
Author: Jan Bodnar
Last modified: April 2019
Website: www.zetcode.com
"""

from tkinter import Tk, Canvas, Frame, BOTH, W

class Example(Frame):

def __init__(self):
super().__init__()

self.initUI()


def initUI(self):

self.master.title("Lyrics")
self.pack(fill=BOTH, expand=1)

canvas = Canvas(self)
canvas.create_text(20, 30, anchor=W, font="Purisa",
text="Most relationships seem so transitory")
canvas.create_text(20, 60, anchor=W, font="Purisa",
text="They're good but not the permanent one")
canvas.create_text(20, 130, anchor=W, font="Purisa",
text="Who doesn't long for someone to hold")
canvas.create_text(20, 160, anchor=W, font="Purisa",
text="Who knows how to love without being told")
canvas.create_text(20, 190, anchor=W, font="Purisa",
text="Somebody tell me why I'm on my own")
canvas.create_text(20, 220, anchor=W, font="Purisa",
text="If there's a soulmate for everyone")
canvas.pack(fill=BOTH, expand=1)


def main():

root = Tk()
ex = Example()
root.geometry("420x250+300+300")
root.mainloop()


if __name__ == '__main__':
main()

0 comments on commit c940d44

Please sign in to comment.