timnoot

hypixel skyblock requests + tkinter simple coin checker

Apr 30th, 2021 (edited)
941
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # discord = timnoot#8017
  2. from tkinter import *
  3.  
  4. import requests
  5.  
  6. root = Tk()
  7.  
  8.  
  9. def total():
  10.     option = []
  11.     root.title("Coin Checker")
  12.  
  13.     def destroy():
  14.         for widget in root.winfo_children():
  15.             widget.destroy()
  16.  
  17.     def show1():
  18.         try:
  19.             playername = e.get()
  20.             destroy()
  21.             data = requests.get(url=f"https://sky.shiiyu.moe/api/v2/coins/{playername}").json()
  22.             profiles = data.get("profiles")
  23.  
  24.             for i in profiles:
  25.                 l = profiles.get(i)
  26.                 l1 = l.get("cute_name")
  27.                 option.append(l1)
  28.             coins_label = Label(root, text="Nothing yet")
  29.             coins_label.grid(row=2, column=0, columnspan=2, sticky="NSEW")
  30.             root.title("Checking " + playername)
  31.  
  32.             def show():
  33.                 data = requests.get(url=f"https://sky.shiiyu.moe/api/v2/coins/{playername}").json()
  34.                 profiles = data.get("profiles")
  35.  
  36.                 for i in profiles:
  37.                     l = profiles.get(i)
  38.                     l1 = l.get("cute_name")
  39.                     option.append(l1)
  40.                 coins_label = Label(root, text="Nothing yet")
  41.                 coins_label.grid(row=2, column=0, columnspan=2, sticky="NSEW")
  42.  
  43.                 profile = clicked.get()
  44.                 for i in profiles:
  45.                     l = profiles.get(i)
  46.                     l1 = l.get("cute_name")
  47.                     if l1 == profile:
  48.                         coins_label.config(text=str(round(l.get("purse"))) + f" coins on the profile {profile}")
  49.                         break
  50.  
  51.             clicked = StringVar()
  52.             clicked.set(option[0])
  53.  
  54.             drop = OptionMenu(root, clicked, *option)
  55.             drop.grid(row=1, column=1, sticky="NSEW", columnspan=1)
  56.             drop.config(width=20)
  57.  
  58.             checkbtn = Button(root, text="check", command=show)
  59.             checkbtn.grid(row=1, column=0, sticky="NSEW", columnspan=1)
  60.             checkbtn.config(width=20)
  61.  
  62.             backbtn = Button(root, text="Back", command=lambda: [destroy(), total()])
  63.             backbtn.grid(row=3, column=0, sticky="NSEW", columnspan=2)
  64.         except Exception as ex:            
  65.             total()
  66.  
  67.     e = Entry(root, width=50)
  68.     e.grid(row=0, column=0, columnspan=2, pady=10, padx=10)
  69.     Button(root, text="check", command=show1).grid(row=1, column=0, columnspan=2, sticky="NSEW", padx=10)
  70.  
  71.  
  72. total()
  73. root.mainloop()
  74.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×