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?
Username Computer Username Computer
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started