Skip to content

Commit

Permalink
Update the format of displaying data
Browse files Browse the repository at this point in the history
Update the format to TreeView (Table)
Update README images and version tag (v1.1.0-alpha)
  • Loading branch information
Alperencode committed Dec 3, 2022
1 parent 7d13d45 commit ee7601c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions NMEA-Project/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import parsers as parser
from tkinter import messagebox
from tkinter import filedialog
from tkinter import messagebox, ttk, filedialog
from tkinter import *

def GUI():
Expand All @@ -17,20 +16,15 @@ def GUI():
return

app.geometry("800x600")
frame = Frame(app)
frame.pack()

label = Label(frame, text="Parsed Data", font=("Calibri", 24, "bold"))
label = Label(app, text="Parsed Data", font=("Calibri", 24))
label.pack()

text = Text(frame, width=300, height=300, font=("Arial", 12))
text.pack()
table = InitializeTable(app)

for key,item in parser.get_result().items():
text.insert(END, " "*50 + f"{'-'*80}\n")
text.insert(END, " "*70 + f"{key} : {item}\n")
table.insert("", "end", text="", values=(key, item))

text.config(state=DISABLED)
app.mainloop()

def ParseFile(sentence_file):
Expand All @@ -42,5 +36,23 @@ def ParseFile(sentence_file):
parser.parse(sentence)
return True

def InitializeTable(app):
table = ttk.Treeview(app, height=12)
table.pack()

style = ttk.Style()
style.configure("Treeview.Heading", font=("Calibri", 20), rowheight=40)
style.configure("Treeview", font=("Calibri", 16), rowheight=40)

table['columns'] = ("Data", "Value")
table.column("#0", width=0, stretch=NO)
table.column("Data", anchor=CENTER, width=350)
table.column("Value", anchor=CENTER, width=350)

table.heading("Data", text="Data", anchor=CENTER)
table.heading("Value", text="Value", anchor=CENTER)

return table

if __name__ == "__main__":
GUI()
Binary file modified images/Tkinter3.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Tkinter4.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/Tkinter5.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ee7601c

Please sign in to comment.