Advertisement
Guest User

Untitled

a guest
Sep 21st, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.33 KB | None | 0 0
  1. import socket
  2. from Tkinter import *
  3.  
  4. port = 8081
  5. s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
  6.  
  7. class App:
  8.     def __init__(self, master):
  9.  
  10.         frame = Frame(master)
  11.         frame.pack()
  12.  
  13.         self.e = Entry(frame)
  14.         self.e.pack(side=LEFT)
  15.        
  16.         self.button = Button(frame, text="quit", command=frame.quit)
  17.         self.button.pack(side=LEFT)
  18.  
  19.         self.hi_there = Button(frame, text="play", command=self.play)
  20.         self.hi_there.pack(side=LEFT)
  21.  
  22.         self.hi_there = Button(frame, text="pause", command=self.pause)
  23.         self.hi_there.pack(side=LEFT)
  24.  
  25.         self.hi_there = Button(frame, text="play next", command=self.next)
  26.         self.hi_there.pack(side=LEFT)
  27.  
  28.         self.hi_there = Button(frame, text="play previous", command=self.previous)
  29.         self.hi_there.pack(side=LEFT)
  30.        
  31.     def play(self):
  32.         host = self.e.get()
  33.         num = '1'
  34.         s.sendto((num), (host, port))
  35.  
  36.     def pause(self):
  37.         host = self.e.get()
  38.         num = '2'
  39.         s.sendto((num), (host, port))
  40.  
  41.     def next(self):
  42.         host = self.e.get()
  43.         num = '3'
  44.         s.sendto((num), (host, port))
  45.  
  46.     def previous(self):
  47.         host = self.e.get()
  48.         num = '4'
  49.         s.sendto((num), host, port)
  50.  
  51.  
  52. root = Tk()
  53.  
  54. app = App(root)
  55.  
  56. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement