Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- import tkinter.font as tkFont
- from tkinter import Label
- class App:
- def __init__(self, root):
- # setting title
- root.title("TV Control Panel")
- # setting window size
- width = 356
- height = 219
- screenwidth = root.winfo_screenwidth()
- screenheight = root.winfo_screenheight()
- alignstr = '%dx%d+%d+%d' % (width, height, (screenwidth - width) / 2, (screenheight - height) / 2)
- root.geometry(alignstr)
- root.resizable(width=False, height=False)
- GButton_419 = tk.Button(root)
- GButton_419["anchor"] = "center"
- GButton_419["bg"] = "#f0f0f0"
- ft = tkFont.Font(family='Times', size=10)
- GButton_419["font"] = ft
- GButton_419["fg"] = "#000000"
- GButton_419["justify"] = "center"
- GButton_419["text"] = "Up"
- GButton_419.place(x=140, y=110, width=70, height=25)
- GButton_419["command"] = self.GButton_419_command
- GButton_928 = tk.Button(root)
- GButton_928["bg"] = "#f0f0f0"
- ft = tkFont.Font(family='Times', size=10)
- GButton_928["font"] = ft
- GButton_928["fg"] = "#000000"
- GButton_928["justify"] = "center"
- GButton_928["text"] = "Down"
- GButton_928.place(x=140, y=150, width=70, height=25)
- GButton_928["command"] = self.GButton_928_command
- GLabel_424 = tk.Label(root)
- ft = tkFont.Font(family='Times', size=26)
- GLabel_424["font"] = ft
- GLabel_424["fg"] = "#333333"
- GLabel_424["justify"] = "center"
- GLabel_424["text"] = "TV Control"
- GLabel_424.place(x=90, y=10, width=178, height=51)
- GLabel_868: Label = tk.Label(root)
- ft = tkFont.Font(family='Times', size=18)
- GLabel_868["font"] = ft
- GLabel_868["fg"] = "#333333"
- GLabel_868["justify"] = "center"
- GLabel_868["text"] = "Volume:"
- GLabel_868.place(x=130, y=60, width=98, height=33)
- def GButton_419_command(self):
- import requests
- import json
- x = requests.get(url='http://192.168.178.9:1925/1/audio/volume')
- y = json.loads(x.text)
- Vol = (y['current'])
- level = Vol + 1
- url = 'http://192.168.178.9:1925/1/audio/volume'
- volume = {'current': level}
- requests.get(url, json=volume)
- x = requests.post(url, json=volume)
- def GButton_928_command(self):
- import requests
- import json
- x = requests.get(url='http://192.168.178.9:1925/1/audio/volume')
- y = json.loads(x.text)
- Vol = (y['current'])
- level = Vol - 1
- url = 'http://192.168.178.9:1925/1/audio/volume'
- volume = {'current': level}
- requests.get(url, json=volume)
- x = requests.post(url, json=volume)
- if __name__ == "__main__":
- root = tk.Tk()
- app = App(root)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment