Screen Rotation Application

from tkinter import *

import rotatescreen

def Screen_rotate(temp):

screen = rotatescreen.get_primary_display()

if temp == "up":

screen.set_landscape()

elif temp == "right":

screen.set_portrait_flipped()

elif temp == "down":

screen.set_landscape_flipped()

elif temp == "left":

screen.set_portrait()

master = Tk()

master.geometry("100x100")

master.title("Screen Rotation")

master.configure(bg='light grey')

result = StringVar()

Button(master, text="Up", command=lambda: Screen_rotate(

"up"), bg="white").grid(row=0, column=3)

Button(master, text="Right", command=lambda: Screen_rotate(

"right"), bg="white").grid(row=1, column=6)

Button(master, text="Left", command=lambda: Screen_rotate(

"left"), bg="white").grid(row=1, column=2)

Button(master, text="Down", command=lambda: Screen_rotate(

"down"), bg="white").grid(row=3, column=3)

mainloop()


No comments: