Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/env python
- # -*- coding: utf-8 -*-
- #
- # GUI module generated by PAGE version 4.13
- # In conjunction with Tcl version 8.6
- # May 22, 2018 07:56:33 AM
- # ======================================================
- # mqttclient.py
- # ------------------------------------------------------
- # Written by G.D. Walters for Full Circle Magazine #134
- # Python in the REAL World # 84 June 2018
- # ======================================================
- import sys
- try:
- from Tkinter import *
- except ImportError:
- from tkinter import *
- try:
- import ttk
- py3 = False
- except ImportError:
- import tkinter.ttk as ttk
- py3 = True
- import mqttclient_support
- def vp_start_gui():
- '''Starting point when module is the main routine.'''
- global val, w, root
- root = Tk()
- mqttclient_support.set_Tk_var()
- top = MQTT_Client (root)
- mqttclient_support.init(root, top)
- root.mainloop()
- w = None
- def create_MQTT_Client(root, *args, **kwargs):
- '''Starting point when module is imported by another program.'''
- global w, w_win, rt
- rt = root
- w = Toplevel (root)
- mqttclient_support.set_Tk_var()
- top = MQTT_Client (w)
- mqttclient_support.init(w, top, *args, **kwargs)
- return (w, top)
- def destroy_MQTT_Client():
- global w
- w.destroy()
- w = None
- class MQTT_Client:
- def __init__(self, top=None):
- '''This class configures and populates the toplevel window.
- top is the toplevel containing window.'''
- _bgcolor = '#d9d9d9' # X11 color: 'gray85'
- _fgcolor = '#000000' # X11 color: 'black'
- _compcolor = '#d9d9d9' # X11 color: 'gray85'
- _ana1color = '#d9d9d9' # X11 color: 'gray85'
- _ana2color = '#d9d9d9' # X11 color: 'gray85'
- top.geometry("495x227+347+264")
- top.title("MQTT Client")
- self.Frame1 = Frame(top)
- self.Frame1.place(relx=0.02, rely=0.04, relheight=0.9, relwidth=0.96)
- self.Frame1.configure(relief=GROOVE)
- self.Frame1.configure(borderwidth="2")
- self.Frame1.configure(relief=GROOVE)
- self.Frame1.configure(width=475)
- self.Label1 = Label(self.Frame1)
- self.Label1.place(relx=0.04, rely=0.17, height=18, width=146)
- self.Label1.configure(text='''Last Message Received:''')
- self.lblLastMessage = Label(self.Frame1)
- self.lblLastMessage.place(relx=0.36, rely=0.15, height=28, width=256)
- self.lblLastMessage.configure(relief=SUNKEN)
- self.lblLastMessage.configure(text='''Label''')
- self.lblLastMessage.configure(textvariable=mqttclient_support.LastMessage)
- self.lblLastMessage.configure(width=256)
- self.Label3 = Label(self.Frame1)
- self.Label3.place(relx=0.19, rely=0.36, height=18, width=67)
- self.Label3.configure(text='''Humidity:''')
- self.lblHumidity = Label(self.Frame1)
- self.lblHumidity.place(relx=0.36, rely=0.34, height=28, width=116)
- self.lblHumidity.configure(relief=SUNKEN)
- self.lblHumidity.configure(text='''Label''')
- self.lblHumidity.configure(textvariable=mqttclient_support.HumidityValue)
- self.lblHumidity.configure(width=116)
- self.Label5 = Label(self.Frame1)
- self.Label5.place(relx=0.15, rely=0.55, height=18, width=90)
- self.Label5.configure(text='''Temperature:''')
- self.lblTemp = Label(self.Frame1)
- self.lblTemp.place(relx=0.36, rely=0.54, height=28, width=116)
- self.lblTemp.configure(relief=SUNKEN)
- self.lblTemp.configure(text='''Label''')
- self.lblTemp.configure(textvariable=mqttclient_support.TempValue)
- self.lblTemp.configure(width=116)
- self.btnQuit = Button(self.Frame1)
- self.btnQuit.place(relx=0.69, rely=0.78, height=26, width=87)
- self.btnQuit.configure(activebackground="#d9d9d9")
- self.btnQuit.configure(command=mqttclient_support.on_btnQuit)
- self.btnQuit.configure(text='''Quit''')
- self.btnQuit.configure(width=87)
- if __name__ == '__main__':
- vp_start_gui()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement