From f7c346463b985b14a0b9158b93ab2f7ecb9e4a50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Sat, 19 Sep 2015 14:16:39 +0200 Subject: [PATCH] --- kemsirve.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/kemsirve.py b/kemsirve.py index d7a3337..72e8e03 100644 --- a/kemsirve.py +++ b/kemsirve.py @@ -1,10 +1,15 @@ from __future__ import print_function import requests -import Tkinter -import tkMessageBox +try: + import Tkinter as tk + import tkMessageBox as tkm +except Exception: + import tkinter as tk + from tkinter import messagebox as tkm -window = Tkinter.Tk() + +window = tk.Tk() window.wm_withdraw() resp = requests.get("https://ws.ovh.com/dedicated/r2/ws.dispatcher/getAvailability2") @@ -13,4 +18,6 @@ for i in resp.json()["answer"]["availability"]: for j in i["metaZones"]: if j["availability"] not in ["unavaible", "unknown"]: print(j["zone"], j["availability"]) - tkMessageBox.showinfo(title="Greetings", message="%s - %s!" % (j["zone"], j["availability"])) + tkm.showinfo(title="Greetings", message="%s: %s - %s!" % (i["reference"], + j["zone"], + j["availability"])) \ No newline at end of file