Created
June 12, 2022 05:26
-
-
Save tai/b84430e495e5d052b03ae245cf7a5f92 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python3 | |
from tkinter import * | |
def flip(ev): | |
entry = ev.widget | |
cur = entry.get() | |
if '/' in cur: | |
cur = '/'.join(reversed(cur.split('/'))) | |
entry.delete(0, 'end') | |
entry.insert(0, cur) | |
def main(): | |
root = Tk() | |
root.geometry("800x80") | |
root.option_add("*font", "Ariel 24") | |
label = Label(root, text="Enter description:") | |
label.pack(side=LEFT) | |
entry = Entry(root) | |
entry.pack(side=LEFT, expand=1, fill=BOTH) | |
entry.bind("<Return>", flip) | |
root.mainloop() | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment