Slip 4
A) Write Python GUI program to create background with changing colors.
from tkinter import *
gui = Tk(className='Python Window Color')
# set window size
gui.geometry("420x220")
#set window color
gui.configure(bg='red')
gui.mainloop()
OR
from tkinter import Button, Entry, Label, Tk
def changecolor():
newvalue = value.get()
gui.configure(background = newvalue)
gui=Tk()
gui.title("color change.")
gui.configure(background = "gray")
gui.geometry("400x300")
color = Label(gui, text = "color", bg = "gray")
value = Entry(gui)
apply = Button(gui, text = "Apply", fg = "Black", bg = "gray", command = changecolor)
color.grid(row=0,column=0)
value.grid(row=0,column=1)
apply.grid(row=0,column=2)
gui.mainloop()
Program Output :
B) Define a class Employee having members id, name, department, salary. Create a subclass called manager with member bonus. Define methods accept and display in both the classes. Create n objects of the manager class and display the details of the manager having the maximum total salary (salary+bonus).
comment 0 Comment
more_vert