# Import required modulesfromtkinterimport*importrotatescreen# User defined function# for rotating screendefScreen_rotation(temp):screen=rotatescreen.get_primary_display()iftemp=="up":screen.set_landscape()eliftemp=="right":screen.set_portrait_flipped()eliftemp=="down":screen.set_landscape_flipped()eliftemp=="left":screen.set_portrait()# Creating tkinter objectmaster=Tk()master.geometry("100x100")master.title("Screen Rotation")master.configure(bg='light grey')# Variable classes in tkinterresult=StringVar()# Creating buttons to change orientationButton(master,text="Up",command=lambda:Screen_rotation("up"),bg="white").grid(row=0,column=3)Button(master,text="Right",command=lambda:Screen_rotation("right"),bg="white").grid(row=1,column=6)Button(master,text="Left",command=lambda:Screen_rotation("left"),bg="white").grid(row=1,column=2)Button(master,text="Down",command=lambda:Screen_rotation("down"),bg="white").grid(row=3,column=3)mainloop()# this code belongs to Satyam kumar (ksatyam858)