Tuesday, May 31, 2022

Upgrade 04: PyQt6 Desktop App Template

The desktop app template has been upgraded to include a tool to update code of the mdi window without exiting entirely from the application. 

Procedure:

Close the main window, update the code from the IDE window and press the "Recompile" button. The main window will be reloaded with the new changes.

The output:



The code:

Can be downloaded from this github repository: https://github.com/bclme/python_desktop_app_template



Sunday, May 29, 2022

PyQt6 Dynamic Programming

This demo program shows how to update a python file and reload it to update the running program without restarting the whole python app.

The output:


The code:

inputs.py:

1
2
3
A = 1.6
B = 7.5
C = 1.5

main.py:



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import inputs
import importlib
import sys
import os
from PyQt6.QtWidgets import QApplication,  QWidget, QPushButton, QLabel

class Window(QWidget):

    def __init__(self):
        super(Window, self).__init__()

        self.initUI()

    def initUI(self):
        D = inputs.A + inputs.B + inputs.C
        self.lbl1 =  QLabel(('Inputs:  A:  ' + str(inputs.A) + '  B: ' + str(inputs.B) + '  C: ' + str(inputs.C)), self)
        self.lbl1.setGeometry(25, 25, 150, 35)
        
        self.lbl2 =  QLabel('Sum: '+ str(D), self)
        self.lbl2.setGeometry(25, 50, 150, 35)
        
        pb1 = QPushButton('Update', self)
        pb1.setGeometry(25, 100, 120, 30)
        
        pb1.clicked.connect(self.onClick_pb1)
        
        pb2 = QPushButton('Recompile', self)
        pb2.setGeometry(150, 100, 120, 30)        
        pb2.clicked.connect(self.onClick_pb2)
        
        

        self.setGeometry(25, 45, 350, 150)
        self.setWindowTitle('Post 37')
        self.show()
        
 
    def onClick_pb2(self):
 
       importlib.reload(inputs)
       
    def onClick_pb1(self):
 
       D = inputs.A + inputs.B + inputs.C
       self.lbl2.setText('Sum: '+ str(D))
       self.lbl1.setText('Inputs:  A:  ' + str(inputs.A) + '  B: ' + str(inputs.B) + '  C: ' + str(inputs.C))
        



    
def onClick_pb1():
    exit()

def main():

    app = QApplication(sys.argv)
    ex = Window()
    sys.exit(app.exec())


if __name__ == '__main__':
    main()

Upgrade 03: PyQt6 Desktop App Template

The Desktop App Template has been upgraded to include global variables(for example: username must be stored in a global variable upon successful login), the global variable(username) is displayed permanently at right-most corner of the status bar, I did some minor code refactoring of the main window by adding a separate function for configuring the right sidebar and lastly, I made the side menu bar(treeview) database driven which means the treeview items are stored in a mysql table.

The output is the same as the original screen(from Upgrade 02) with the exception of the username getting displayed permanently at the status bar.


The mysql table definition:

1
2
3
4
5
6
7
8
CREATE TABLE `tbsidebar` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `parent` varchar(25) NOT NULL,
 `node1` int(11) NOT NULL,
 `name` varchar(25) NOT NULL,
 `node_name` varchar(25) NOT NULL,
 PRIMARY KEY (`id`)
 ) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1

The code:

Can be downloaded from this github repository: https://github.com/bclme/python_desktop_app_template

Monday, May 23, 2022

Create a 3-Layer Back Propagation Neural Network with Sigmoid, SGD and Relu Activation Function

 The demo program shows how to create a 3-layer back propagation neural network with sigmoid, stocastic gradient descent(sgd) and rectified linear unit(relu) activation function. The dataset used is the same as in this post (Predictive Model: Customer Subsciption(Continue/Discontinue) with Tensorflow). The dataset can be downloaded from kaggle. I used 50 records from the dataset.

The program is derived from this article.

The result in the original post using tensorflow is 79% accuracy while this program's result is 86%.

Saturday, May 14, 2022

Tensorflow: Save and Load Model to retrain

 This demo program show how to save a trained model and then load it for retraining. I splitted the original file into 2 which I used in this post "Predictive Model: Customer Subsciption (Continue/Discontinue) with Tensorflow". 


The output:

Orignal Model Accuracy result:


Loaded Model Accuracy result:


The code:

First program:


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
import pandas as pd
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import Sequential, load_model
from tensorflow.keras.layers import Dense, Flatten
from sklearn.metrics import accuracy_score
from sklearn.metrics import ConfusionMatrixDisplay, classification_report, confusion_matrix
from matplotlib import style
import tensorflow as tf
from tensorflow import keras


style.use('classic')
df = pd.read_csv('cont_subs.csv')
X = pd.get_dummies(df.drop(['cont_subs', 'Customer ID'], axis=1))
y = df['cont_subs'].apply(lambda x: 1 if x=='Yes' else 0)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.15)
X.columns

y_train.head()

model = Sequential()
model.add(Dense(units=64, activation='relu', input_dim=len(X_train.columns)))
model.add(Dense(units=128, activation='relu'))
model.add(Dense(units=128, activation='relu'))
model.add(Dense(units=1, activation='sigmoid'))

checkpoint_path = "training_1/cp.ckpt"
checkpoint_dir = os.path.dirname(checkpoint_path)

# Create a callback that saves the model's weights
cp_callback = tf.keras.callbacks.ModelCheckpoint(filepath=checkpoint_path,
                                                 save_weights_only=True,
                                                 verbose=1)

model.compile(loss='binary_crossentropy', optimizer='sgd', metrics='accuracy')

model.fit(X_train, y_train, epochs=256, batch_size=32, callbacks=[cp_callback])

y_hat = model.predict(X_test)
y_hat = [0 if val < 0.5 else 1 for val in y_hat]

print('Model Accuracy' + str(accuracy_score(y_test, y_hat)))

# Display the model's architecture
model.summary()

cm = confusion_matrix(y_test, y_hat)
disp = ConfusionMatrixDisplay(confusion_matrix = cm)
disp.plot()

model.save('my_model')

 

The Loaded Model Program:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import os
import pandas as pd
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import Sequential, load_model
from tensorflow.keras.layers import Dense, Flatten
from sklearn.metrics import accuracy_score
from sklearn.metrics import ConfusionMatrixDisplay, classification_report, confusion_matrix
from matplotlib import style
import tensorflow as tf
from tensorflow import keras


style.use('classic')
df = pd.read_csv('cont_subs1.csv')
X = pd.get_dummies(df.drop(['cont_subs', 'Customer ID'], axis=1))
y = df['cont_subs'].apply(lambda x: 1 if x=='Yes' else 0)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.15)
X.columns
y_train.head()

new_model = tf.keras.models.load_model('my_model')

# Check its architecture
new_model.summary()
new_model = Sequential()
new_model.add(Dense(units=64, activation='relu', input_dim=len(X_train.columns)))
new_model.add(Dense(units=128, activation='relu'))
new_model.add(Dense(units=1, activation='sigmoid'))

checkpoint_path = "training_1/cp.ckpt"
checkpoint_dir = os.path.dirname(checkpoint_path)

# Create a callback that saves the model's weights
cp_callback = tf.keras.callbacks.ModelCheckpoint(filepath=checkpoint_path,
                                                 save_weights_only=True,
                                                 verbose=1)

new_model.compile(loss='binary_crossentropy', optimizer='sgd', metrics='accuracy')
new_model.fit(X_train, y_train, epochs=256, batch_size=32, callbacks=[cp_callback])
new_model.evaluate(X_train, y_train, verbose=2)
y_hat = new_model.predict(X_test)
y_hat = [0 if val < 0.5 else 1 for val in y_hat]

#accuracy_score(y_test, y_hat)
print('Loaded Model Accuracy' + str(accuracy_score(y_test, y_hat))) 


model.save('my_model')

new_model.summary()

Thursday, May 12, 2022

Create a Rich Text Document with Image and Printpreview using QTextEdit in PyQt6

This demo program shows how to create a rich text document with an image and print preview the contents.

The Output:




The code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from PyQt6.QtWidgets import QWidget, QPushButton, QApplication, QTextEdit
from PyQt6.QtCore import Qt
from PyQt6 import QtPrintSupport

import sys
class Example(QWidget):

    def __init__(self):
        super().__init__()

        self.initUI()


    def initUI(self):
    
        self.etext = QTextEdit(self)  
        self.etext.setReadOnly(True)        
        self.etext.setGeometry(25, 40, 300, 300)
        redText = "<span style=\" font-size:8pt; font-weight:600; color:#ff0000;\" >"
        redText = redText  + "I want this text red"
        redText = redText  + "</span>"
        self.etext.append(redText)

        blackText = "<p><span style=' font-size:12pt;'>CENTER</span></p>"      
        self.etext.append(blackText)
        self.etext.setAlignment(Qt.AlignmentFlag.AlignCenter)
        
        img = "<p><img src='balloon.png' style='width:50px;height:60px;' ></p>"
        self.etext.append(img)
        self.etext.setAlignment(Qt.AlignmentFlag.AlignRight)
        
        self.redb = QPushButton('Preview', self)       
        self.redb.setGeometry(250, 370, 80, 40)
        self.redb.clicked.connect(self.handlePreview)
        self.setGeometry(200, 100, 350, 430)
        self.setWindowTitle('Post 33')
        self.show()
        
    def handlePreview(self):
        dialog = QtPrintSupport.QPrintPreviewDialog()
        dialog.paintRequested.connect(self.etext.print)
        dialog.exec()  
def main():
    
    app = QApplication(sys.argv)
    ex = Example()
    
    sys.exit(app.exec())
   

if __name__ == '__main__':
    main()        

Wednesday, May 11, 2022

Upgrade 02: PyQt6 Desktop App Template

This demo program add another improvement of the desk top app template(original post here). The newly added feature is a the ability to login, a simple password encryption(sha256) and connecting to sa mysql database. Also added a top layer file that should perform system configuration before the splash screen is shown.

 

Login Info:

  UserName : admin

  Password :  Appl3Tr33.456

The output:

 


The mysql table:

 

1
2
3
4
5
6
7
CREATE TABLE `tbusr` (
 `id` int(11) NOT NULL AUTO_INCREMENT,
 `username` varchar(256) NOT NULL,
 `userpassword` varchar(2048) NOT NULL,
 PRIMARY KEY (`id`),
 UNIQUE KEY `ind_usr` (`username`)
 ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1

 

The code:

The python code to encrypt the password:

 

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import os
import hashlib
import hmac
password = "Appl3Tr33.456"
password = password.encode()
#salt = os.urandom(16)
password_hash = hashlib.pbkdf2_hmac("sha256", password, salt, 100000)

salt = b'4\xa8y\x8e\xca\xfb\x7f\x8e\xd5\x97v\x14\xc7[Z\xd0'
print(salt)
print(password_hash)

popular_app.py:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from imports import *
from splash import SplashScreen
class App(a.QWidget):
    def __init__(self, parent=None):
        super().__init__()
        self.setWindowTitle("")
        self.do_logging()
        self.setFixedSize(0, 0)
        self.hide()
        t.sleep(1)
        self.splash1 = SplashScreen()
        self.splash1.show() 
    def do_logging(self):
        print("Do something here...")
 
        
def main():

    app = a.QApplication(s.argv)
    app.setStyleSheet('''
        #title_label {
            font-size: 50px;
            color: #F0B21A;
        }
        #desc_label {
            font-size: 15px;
            color: #F0B21A;
        }
        #loading_label {
            font-size: 20px;
            color: #F0B21A;
        }
        QFrame {
            background-color: #2F339B;
            color: #c8c8c8;
        }
    ''')
    ex = App()
    s.exit(app.exec())


if __name__ == '__main__':
    main()


login.py:


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
from imports import *
import mysql.connector as mysql
import hashlib
import hmac
import pandas as pd
from mainw import Window2

TIME_LIMIT = 100
class WindowApp(a.QMainWindow):
    def __init__(self, parent=None):
        super().__init__()
        self.setWindowTitle("Login")
        self.setFixedSize(320, 245)
        self.quit = g.QAction("Quit", self)
        self.quit.triggered.connect(self.closeEvent)
        self.move(400, 200) 
        lblusr =  a.QLabel('UserName', self)
        lblusr.setStyleSheet('QLabel {background-color: transparent; color: black;}')
        lblusr.setGeometry(25, 55, 100, 30) 
        self.txtusr = a.QLineEdit('', self) 
        
        self.txtusr.setGeometry(100, 55, 150, 30)  
        lblpwd =  a.QLabel('Password', self)
        lblpwd.setStyleSheet('QLabel {background-color: transparent; color: black;}')
        lblpwd.setGeometry(25, 100, 100, 30) 
        self.txtpwd = a.QLineEdit('', self) 
        self.txtusr.setPlaceholderText("Enter Username Here")
        self.txtpwd.setPlaceholderText("Enter Password Here")
        self.txtpwd.setGeometry(100, 100, 150, 30) 
        self.txtpwd.setEchoMode(a.QLineEdit.EchoMode.Password)        
        self.pblogin = a.QPushButton('Login', self)
        self.pblogin.setEnabled(False)
        self.pblogin.setGeometry(100, 165, 65, 25)
        self.pblogin.clicked.connect(self.onClick_pb3)  
        self.txtpwd.textChanged.connect(self.on_text_changed)
        self.txtusr.textChanged.connect(self.on_text_changed)
        pbcanc = a.QPushButton('Cancel', self)
        pbcanc.setGeometry(180, 165, 65, 25)
        pbcanc.clicked.connect(self.onClick_pb4)  
        self.statusBar = a.QStatusBar()
        self.setStatusBar(self.statusBar)
        self.statusBar.showMessage("Ready", 5000)        
        #self.show()
        
        self.progressBar = a.QProgressBar()
        self.progressBar.setStyleSheet("""QProgressBar {
            background-color: transparent;
            color: #9B2F6A;
            border-style: none;
            border-radius: 5px;
            text-align: center;
            font-size: 10px;
        }
        QProgressBar::chunk {
            border-radius: 5px;
            background-color: qlineargradient(spread:pad x1:0, x2:1, y1:0.511364, y2:0.523, stop:0 #E1F01A);
        }""")
        self.statusBar.addPermanentWidget(self.progressBar)
        self.progressBar.move(30, 40)
        self.progressBar.setFixedSize(120, 20)
        #self.progressBar.setValue(100)
    def on_text_changed(self):
        self.pblogin.setEnabled(bool(self.txtusr.text()) and bool(self.txtpwd.text()))
        
    def closeEvent(self, event):
        close = a.QMessageBox()
        close.setIcon(a.QMessageBox.Icon.Question)
        close.setWindowTitle('Pls confirm')
        close.setStyleSheet('QLabel {background-color: transparent; color: black;}')
        close.setText("Do you really want to quit?")
        close.setStandardButtons(a.QMessageBox.StandardButton.Yes | a.QMessageBox.StandardButton.Cancel)
        close = close.exec()

        if close == a.QMessageBox.StandardButton.Yes:
            event.accept()
        else:
            event.ignore()
    def onClick_pb3(self):
        db = mysql.connect(
             host = "localhost",
             user = "root",
             passwd = "",
             database = "pop_app"
        )
        cursor = db.cursor()
        t1 = self.txtusr.text()
        t2 = self.txtpwd.text()
        salt = b'4\xa8y\x8e\xca\xfb\x7f\x8e\xd5\x97v\x14\xc7[Z\xd0'
        print(t2)
        t2 = hashlib.pbkdf2_hmac("sha256", t2.encode(), salt, 100000)
        
        t1 = repr(str(t1))
        t2 = repr(str(t2))
        print(t2)
        query = "SELECT * FROM tbusr where username = %s and userpassword  = %s" %(t1, t2)
        cursor.execute(query)
        records = cursor.fetchall()
        df = pd.DataFrame(records) 
        count = 0
        while count < TIME_LIMIT:
            count += 1
            t.sleep(0.01)
            self.progressBar.setValue(count)
        if df.empty:    
            self.statusBar.showMessage("User not found!", 5000)
            self.txtusr.setStyleSheet('QLineEdit {background-color: #ffe6e6; color: black;}')
            self.txtusr.repaint()
            t.sleep(1.5)  
            self.txtusr.setStyleSheet('QLineEdit {background-color: white; color: black;}')
            self.txtusr.repaint()
        else:
            self.statusBar.showMessage("User found!", 5000)
            self.statusBar.repaint()
            t.sleep(2)
            self.showWindow2()
            
            self.hide()
            
        #self.w = Window2()       
        #self.w.show()
        
    def showWindow2(self):
        self.mdiwindow = Window2()
        self.mdiwindow.show()
    def onClick_pb4(self):
        self.quit 
        self.close()    
          
if __name__ == "__main__":       
    app = a.QApplication(s.argv)
    app.setStyleSheet('''        
        QProgressBar {
            background-color: #000000;
            color: #9B2F6A;
            border-style: none;
            border-radius: 4px;
            text-align: center;
            font-size: 10px;
        }
        QProgressBar::chunk {
            border-radius: 4px;
            background-color: qlineargradient(spread:pad x1:0, x2:1, y1:0.511364, y2:0.523, stop:0 #E1F01A);
        }
    ''')
    splash = WindowApp()
    splash.show()
    s.exit(app.exec())

Monday, May 2, 2022

Global Variables Handling across PyQt6 Windows

This demo program shows how to handle global variables across files or PyQt6 windows and execute a function from another file.


The output:




The code:

config.py:

1
2
a = 0
b = "empty"

update.py:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
import config

config.a = 10
config.b = "alphabet"

def update(arg1, arg2):
    config.a = arg1
    config.b = arg2
    
def add(arg1, arg2):
    return arg1 + arg2

main.py:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
from imports import *
from main1 import WindowApp1
import config
import update



class WindowApp(a.QMainWindow):
    def __init__(self, parent=None):
        super().__init__()
        self.setWindowTitle("Post 31")
        self.setFixedSize(320, 245)
        
        lbla =  a.QLabel('Global a: ', self)        
        lbla.setGeometry(25, 55, 100, 30) 
        
        self.txta = a.QLineEdit(str(config.a), self)        
        self.txta.setGeometry(100, 55, 50, 30) 
        
        self.lbla_r =  a.QLabel(str(config.a), self)        
        self.lbla_r.setGeometry(170, 55, 50, 30)
        
        lblb =  a.QLabel('Global b: ', self)        
        lblb.setGeometry(25, 100, 100, 30) 
        
        self.txtb = a.QLineEdit(config.b, self) 
        self.txtb.setGeometry(100, 100, 50, 30) 
        
        self.lblb_r =  a.QLabel(config.b, self)        
        self.lblb_r.setGeometry(170, 100, 50, 30) 
        
        self.pblogin = a.QPushButton('Login', self)
        self.pblogin.setGeometry(50, 195, 65, 25)
        self.pblogin.clicked.connect(self.onClick_pb3)
        
        pbcanc = a.QPushButton('Update', self)
        pbcanc.setGeometry(125, 195, 65, 25)
        pbcanc.clicked.connect(self.onClick_pb4)
        
        pbcalc = a.QPushButton('Function', self)
        pbcalc.setGeometry(200, 195, 65, 25)
        pbcalc.clicked.connect(self.onClick_pb5)
        
        lblf =  a.QLabel('Function: ', self)        
        lblf.setGeometry(25, 140, 75, 30) 
        
        self.txtfa = a.QLineEdit(self) 
        self.txtfa.setGeometry(100, 140, 40, 30)
        
        lblfp =  a.QLabel('+', self)        
        lblfp.setGeometry(150, 140, 10, 30) 
        
        self.txtfb = a.QLineEdit(self) 
        self.txtfb.setGeometry(165, 140, 40, 30)
        
        self.lblf_r =  a.QLabel( self)        
        self.lblf_r.setGeometry(215, 140, 40, 30)
        
    def onClick_pb3(self):
        self.mdiwindow = WindowApp1()
        self.mdiwindow.show()
        self.hide()
    def onClick_pb4(self): 
          
        a = int(self.txta.text())
        b = self.txtb.text()

        update.update(a,b)
        
        self.lbla_r.setText(str(config.a))
        self.lblb_r.setText(config.b)
 
    def onClick_pb5(self):
        self.lblf_r.setText('= ' + str(update.add(int(self.txtfa.text()),int(self.txtfb.text())))) 

if __name__ == "__main__":       
    app = a.QApplication(s.argv)
 
    splash = WindowApp()
    splash.show()
    s.exit(app.exec())        

main1.py:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from imports import *
import config




class WindowApp1(a.QMainWindow):
    def __init__(self, parent=None):
        super().__init__()
        self.setWindowTitle("Post 31")
        self.setFixedSize(320, 245)
        self.lbla =  a.QLabel('Global a: ', self)        
        self.lbla.setGeometry(25, 55, 100, 30) 
        
        self.lblb =  a.QLabel('Global b: ', self)        
        self.lblb.setGeometry(25, 100, 100, 30)
        
        self.pblogin = a.QPushButton('End', self)
        self.pblogin.setGeometry(100, 165, 65, 25)
        self.pblogin.clicked.connect(self.onClick_pb3)
        pbcanc = a.QPushButton('Print', self)
        pbcanc.setGeometry(180, 165, 65, 25)
        pbcanc.clicked.connect(self.onClick_pb4)
        
        
    def onClick_pb3(self):       
        self.close()
        
    def onClick_pb4(self): 
     
        self.lbla.setText('Global a: ' + str(config.a))
        self.lblb.setText('Global b: ' + config.b)
if __name__ == "__main__":       
    app = a.QApplication(s.argv)
 
    splash = WindowApp1()
    splash.show()
    s.exit(app.exec())