Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1. from tkinter import *
  2.  
  3. def fromStringToInputFile(inputText):
  4. f = open("input","w+")
  5. f.write('@prefix xsd: http://www.w3.org/2001/XMLSchema# .\n')
  6. f.write('@prefix nif: http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core# .\n')
  7. f.write('@prefix dbpedia: http://dbpedia.org/resource/ .\n')
  8. f.write('@prefix itsrdf: http://www.w3.org/2005/11/its/rdf# .\n')
  9. f.write('<http://example.com/example-task1#char=0,' + len(inputText) + '>\n')
  10. f.write(' a nif:RFC5147String , nif:String , nif:Context ;\n')
  11. f.write(' nif:beginIndex "0"^^xsd:nonNegativeInteger ;\n')
  12. f.write(' nif:endIndex "' + len(inputText) + '"^^xsd:nonNegativeInteger ;\n')
  13. f.write(' nif:isString "' + inputText + '"@en .\n')
  14. f.close()
  15.  
  16. def clicked():
  17. test = txt.get()
  18. fromStringToInputFile(test)
  19. wynik.config(state=NORMAL)
  20. wynik.insert(1.0,test)
  21. wynik.config(state=DISABLED)
  22. if __name__ == '__main__':
  23. window = Tk()
  24. window.resizable(width=False, height=False)
  25. window.title("Task 1")
  26. window.geometry('720x480')
  27. lbl = Label(window, text="Enter your text:")
  28. wynik = Text(window,height=24,width=87)
  29. wynik.config(state=DISABLED)
  30. lbl.grid(column=0, row=0)
  31. lbl.place(x=10,y=10)
  32. #textwrap.fill(lb2, width=200)
  33. wynik.place(x=10,y=80)
  34. txt = Entry(window, width=100)
  35. txt.grid(column=1, row=0)
  36. txt.place(x=100,y=10)
  37. btn = Button(window, text="Check", command=clicked)
  38. btn.grid(column=5, row=5)
  39. btn.place(x=340,y=40)
  40. window.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement