· 5 years ago · Dec 16, 2020, 06:30 PM
1import tkinter as tk
2from tkinter import ttk, StringVar, Tk
3from tkinter.filedialog import *
4from tkinter.messagebox import *
5from tkinter.font import Font
6from tkinter.scrolledtext import *
7
8PlayerTag = 'TORN_Name'
9PlayerId = 'TORN_ID'
10ApiKey = 'API_KEY'
11
12#Create the window
13window = tk.Tk()
14window.title('Api Mobile Testing')
15window.geometry('500x250')
16ttk.Label(window, text = "Mobile TORN API App", foreground ="green",
17font = ("Arial", 12)).grid(row = 0, column = 1)
18
19ttk.Label(window, text = "Category:", font = ("Arial", 10)).grid(column = 0, row = 2, padx = 0, pady = 25)
20n = tk.StringVar()
21category_state = ttk.Combobox(window, width = 24, textvariable = n)
22
23#Connect the API key to the selection state value to extract the json category to a read-only text document via selection
24category_state['values'] = ("rank",
25 "level",
26 "gender",
27 "property",
28 "signup",
29 "awards",
30 "friends",
31 "enemies",
32 "forum_posts",
33 "karma",
34 "age",
35 "role",
36 "Civilian",
37 "donator",
38 "player_id",
39 "name",
40 PlayerTag,
41 "property_id",
42 "competition")
43
44root = Tk()
45root.geometry("300x250+300+300")
46root.minsize(width=400, height=400)
47
48text = ScrolledText(root, state='normal', height=400, width=400, wrap='word', pady=2, padx=3, undo=True)
49text.pack(fill=Y, expand=1)
50text.focus_set()
51
52category_state.grid(column = 1, row = 2)
53category_state.current()
54
55t = Text(root)
56t.pack(fill=BOTH, expand=1)
57
58root = mainloop()