Exemplo n.º 1
0
def destroy_window():
    # Function which closes the window.
    global top_level
    serialport.close_serial()
    print("Object finished)")
    top_level.destroy()
    top_level = None
Exemplo n.º 2
0
def connect_comport():
    global w
    if serialport.isportopen():  # if port open close it
        w.led_connect.configure(background="white")
        w.btn_Connect.configure(text="""Connect""")
        print("PM2_support.connect_comport")
        updatetitle("Disconnected")
        serialport.close_serial()
    else:
        serialconfig = comportconfig_support.Readconfig()  # otherwise open it
        print("Open serial settings", serialconfig)
        print("PM2_support.connect_comport")
        sys.stdout.flush()
        updatetitle("Open Comport1 " + "," + serialconfig["baudrate"] + "," + serialconfig["comport"])
        serialport.open_serial()
        w.btn_Connect.configure(text="""Disconnect""")
        w.led_connect.configure(background="green")

    sys.stdout.flush()