munyal-client/misc.py

29 lines
609 B
Python
Raw Normal View History

2019-08-10 01:44:09 +00:00
import base64
import os
import pickle
import sys
from tkinter import Button, Label, Toplevel
from tcping import Ping
def check_network(ip, port):
ping = Ping(ip, port, 20)
ping.ping(1)
return ping.result.rows[0].successed == 1
def get_os():
if sys.platform in ["linux", "windows"]:
return sys.platform
raise Exception("OS not supported")
def alert(window, message, title="Munyal"):
child = Toplevel(window)
child.title(title)
label = Label(child, text=message)
button = Button(child, text="Aceptar", command=child.destroy)
label.pack()
button.pack()