#! /usr/bin/env python

import Twitch
import Tkinter

def submit():
	channel = channelEntry.get()
	dataEntry.config(state=Tkinter.NORMAL)
	dataEntry.delete(0, Tkinter.END)
	dataEntry.insert(0, Twitch.grab(channel))
	dataEntry.config(state='readonly')

def copy():
	rootWindow.clipboard_clear()
	rootWindow.clipboard_append(dataEntry.get())

rootWindow = Tkinter.Tk()
rootWindow.geometry('600x120')
rootWindow.title("GrabTwitch")
channelEntry = Tkinter.Entry(rootWindow)
submitButton = Tkinter.Button(rootWindow, command=submit, text='Submit')
dataEntry = Tkinter.Entry(rootWindow, state='readonly')
copyButton = Tkinter.Button(rootWindow, command=copy, text='Copy')

rootWindow.bind("<Return>", lambda x: submit())

channelEntry.pack(fill=Tkinter.X)
submitButton.pack(fill=Tkinter.X)
dataEntry.pack(fill=Tkinter.X)
copyButton.pack(fill=Tkinter.X)

rootWindow.mainloop()

@@ -22,80 +22,303 @@
 n%0A%0Ai
-mport Twitch%0Aimport Tkinter%0A%0Adef submit():%0A%09channel = channelEntry.get()
+sMac = True%0Atry:%0A%09import Foundation%0Aexcept ImportError:%0A%09isMac = False%0A%0Aimport Twitch%0Aimport Tkinter%0Aimport os%0A%0Adef setButtons(s):%0A%09copyButton.config(state=s)%0A%09qtpButton.config(state=s)%0A%0Adef submit():%0A%09channel = channelEntry.get()%0A%09data = Twitch.grab(channel)%0A%09if data == '':%0A%09%09data = 'OFFLINE'%0A
 %0A%09da
@@ -409,36 +409,20 @@
 sert(0, 
-Twitch.grab(channel)
+data
 )%0A%09dataE
@@ -456,94 +456,533 @@
 ')%0A%0A
-def copy():%0A%09rootWindow.clipboard_clear()%0A%09rootWindow.clipboard_append(dataEntry.get()
+%09if data == 'OFFLINE':%0A%09%09setButtons(Tkinter.DISABLED)%0A%09else:%0A%09%09setButtons(Tkinter.NORMAL)%0A%0Adef copy():%0A%09rootWindow.clipboard_clear()%0A%09rootWindow.clipboard_append(dataEntry.get())%0A%0Adef qtp():%0A%09script = 'tell app %22Quicktime Player%22 to open URL %22' + dataEntry.get() + '%22'%0A%09Foundation.NSAppleScript.alloc().initWithSource_(script).executeAndReturnError_(None)%0A%09script = 'tell app %22Quicktime Player%22 to set audio volume of last document to 0.5'%0A%09Foundation.NSAppleScript.alloc().initWithSource_(script).executeAndReturnError_(None
 )%0A%0Ar
@@ -1036,9 +1036,9 @@
 00x1
-2
+4
 0')%0A
@@ -1304,16 +1304,130 @@
 ='Copy')
+%0AqtpButton = Tkinter.Button(rootWindow, command=qtp, text='Open in Quicktime Player')%0AsetButtons(Tkinter.DISABLED)
 %0A%0ArootWi
@@ -1599,16 +1599,58 @@
 inter.X)
+%0Aif isMac:%0A%09qtpButton.pack(fill=Tkinter.X)
 %0A%0ArootWi

Add Open in Quicktime Player button for macs