Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- def fromStringToInputFile(inputText):
- f = open("input","w+")
- f.write('@prefix xsd: http://www.w3.org/2001/XMLSchema# .\n')
- f.write('@prefix nif: http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core# .\n')
- f.write('@prefix dbpedia: http://dbpedia.org/resource/ .\n')
- f.write('@prefix itsrdf: http://www.w3.org/2005/11/its/rdf# .\n')
- f.write('<http://example.com/example-task1#char=0,' + len(inputText) + '>\n')
- f.write(' a nif:RFC5147String , nif:String , nif:Context ;\n')
- f.write(' nif:beginIndex "0"^^xsd:nonNegativeInteger ;\n')
- f.write(' nif:endIndex "' + len(inputText) + '"^^xsd:nonNegativeInteger ;\n')
- f.write(' nif:isString "' + inputText + '"@en .\n')
- f.close()
- def clicked():
- test = txt.get()
- fromStringToInputFile(test)
- wynik.config(state=NORMAL)
- wynik.insert(1.0,test)
- wynik.config(state=DISABLED)
- if __name__ == '__main__':
- window = Tk()
- window.resizable(width=False, height=False)
- window.title("Task 1")
- window.geometry('720x480')
- lbl = Label(window, text="Enter your text:")
- wynik = Text(window,height=24,width=87)
- wynik.config(state=DISABLED)
- lbl.grid(column=0, row=0)
- lbl.place(x=10,y=10)
- #textwrap.fill(lb2, width=200)
- wynik.place(x=10,y=80)
- txt = Entry(window, width=100)
- txt.grid(column=1, row=0)
- txt.place(x=100,y=10)
- btn = Button(window, text="Check", command=clicked)
- btn.grid(column=5, row=5)
- btn.place(x=340,y=40)
- window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement