Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- _root = frame1
- with open("T:/TechOS/Virtual/Info/Version.info", "r") as f:
- version = f.read()
- changes = {}
- with open("T:/TechOS/Virtual/Info/Changelog.txt", "r") as f:
- changelog = f.read()
- for line in changelog.splitlines():
- changeid = line.split(":", 1)[0]
- update = changeid.split(".", 1)[0]
- number = int(changeid.split(".", 1)[1])
- change = line.split(":", 1)[1]
- if number == 0:
- changes[update] = []
- else:
- pass
- changes[update].append(change)
- title = tk.Label(_root, bg='white', fg='#00afff', text="What's New in TechOS", font='TkDefaultFont 20')
- title.pack(side='top', anchor='nw', padx=5, pady=5)
- header = tk.Label(_root, bg='white', text="Version", font='TkDefaultFont 15')
- header.pack(side='top', anchor='nw', padx=5, pady=5)
- content = tk.Label(_root, bg='white', justify='left', padx=10, pady=10, wraplength=500)
- content.pack(side='top', anchor='nw')
- def loadversion(vs):
- global changes, header, content
- header.config(text=f"Version {vs}")
- conts = ""
- for i in changes[vs]:
- conts += "- " + i + "\n\n"
- content.config(text=conts)
- def prev():
- global version, changes, loadversion
- preversion = str(int(version) - 1)
- try:
- if changes[preversion]:
- version = preversion
- loadversion(version)
- else:
- pass
- except KeyError:
- pass
- def nxt():
- global version, changes, loadversion
- nxtversion = str(int(version) + 1)
- try:
- if changes[nxtversion]:
- version = nxtversion
- loadversion(version)
- else:
- pass
- except KeyError:
- pass
- previous = tk.Button(_root, bg='white', bd=0, activebackground='lightgray', text='< Previous Version', padx=5, pady=5, command=prev)
- previous.pack(side='left', anchor='sw')
- next = tk.Button(_root, bg='white', bd=0, activebackground='lightgray', text='Next Version >', padx=5, pady=5, command=nxt)
- next.pack(side='right', anchor='se')
- loadversion(version)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement