Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#!/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?

image text in transcribed

Username Computer Username Computer

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions