Question: #!/usr/bin/python # -*- coding: utf-8 -*- import sys from PyQt4 import QtGui global username username = class Home(QtGui.QWidget): def __init__(self): super(Home, self).__init__() self.initUI()

#!/usr/bin/python # -*- coding: utf-8 -*- import sys from PyQt4 import QtGui

global username username = " "

class Home(QtGui.QWidget): def __init__(self): super(Home, self).__init__()

self.initUI()

def initUI(self): font = QtGui.QFont("Arial",10,QtGui.QFont.Bold,False)

username = QtGui.QLabel('Username',self) username.move(10,40) username.setFont(font);

usernameEdit = QtGui.QLineEdit(self) usernameEdit.move(100,35) usernameEdit.textChanged[str].connect(self.onChangedusername) usernameEdit.setFocus()

btn = QtGui.QPushButton('Login', self) btn.move(10, 80) btn.setFixedWidth(130) btn.setFixedHeight(50) btn.setStyleSheet("background-color: #FF0000") #red color btn.clicked.connect(self.begin) btn.setFont(font)

self.setGeometry(5, 30, 600, 300) self.setWindowTitle('CSCI351') #Update window title to CSCI351 self.show() def onChangedusername(self, text): global username username = str(text) def begin(self): print username def main(): app = QtGui.QApplication(sys.argv) ex = Home() sys.exit(app.exec_())

if __name__ == '__main__': main()

1. Update the window title to CSCI351 - Course Registration

2. Change the Login button color. Hint: Use hex color codes

3. Update the code to print Hello username- when the Login button is clicked.

4. Add a new button called Logout that prints Goodbye when clicked.

Can you help me to this python code at number 3 and 4?

#!/usr/bin/python # -*- coding: utf-8 -*- import sys from PyQt4 import QtGui

Username Computer Username Computer

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!