Created
January 19, 2018 16:43
-
-
Save Der-Eddy/de2c1182924132b3abac74c79409534d to your computer and use it in GitHub Desktop.
Paragraph Sorter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tkinter import * | |
def sortText(): | |
text = T.get(1.0, END)[:-2] | |
lst = text.split('\n\n') | |
lst.sort() | |
print(lst) | |
T.delete(1.0, END) | |
T.insert(END, '\n\n'.join(lst)) | |
root = Tk() | |
S = Scrollbar(root) | |
T = Text(root, height=50, width=150) | |
B = Button(root, text='Sort', command=sortText, width=50) | |
S.pack(side=RIGHT, fill=Y) | |
T.pack(side=TOP, fill=Y) | |
B.pack(side=BOTTOM) | |
S.config(command=T.yview) | |
T.config(yscrollcommand=S.set) | |
mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment