Brightness Controller

This application provides a GUI to change brightness of Primary and Secondary Display. Source available at http://github. com/lordamit/Brightness. ”’ self. InitUI() self. Center() self. Show() def InitUI(self): panel = wx. Panel(self) self. vbox = wx. BoxSizer(wx. VERTICAL) button_about = wx. Button(panel, label=’? ‘, size=(25, 25)) button_about. Bind(wx. EVT_BUTTON, self. about_dialog) self. vbox. Add(button_about, flag=wx. ALIGN_RIGHT) hbox1 = wx. BoxSizer(wx. HORIZONTAL) if self. no_of_detected_device == 1 or self. o_of_detected_device == 2: st1 = wx. StaticText(panel, label=’ Primary’) hbox1. Add(st1, flag=wx. RIGHT | wx. TOP, border=3) slider1 = wx. Slider(panel, value=100, minValue=1, maxValue=100, size=(200, -1), style=wx. SL_HORIZONTAL) hbox1. Add(slider1, flag=wx. LEFT | wx. RIGHT, border=25) slider1. Bind(wx. EVT_SCROLL, self. primary_scroll) else: st1 = wx. StaticText(panel, label=’ Primary Not Found’) hbox1. Add(st1, flag=wx. RIGHT | wx. TOP, border=3) self. vbox. Add(hbox1) self. hbox2 = wx. BoxSizer(wx. HORIZONTAL) if self. no_of_detected_device == 2: t2 = wx. StaticText(panel, label=’ Secondary’) self. hbox2. Add(st2, flag=wx.

RIGHT | wx. TOP, border=3) slider2 = wx. Slider(panel, value=100, minValue=1, maxValue=100, size=(200, -1), style=wx. SL_HORIZONTAL) self. hbox2. Add(slider2, flag=wx. LEFT, border=7) slider2. Bind(wx. EVT_SCROLL, self. secondary_scroll) else: st2 = wx. StaticText(panel, label=’ Secondary Not found’) self. hbox2. Add(st2, flag=wx. RIGHT | wx. TOP, border=3) self. vbox. Add(self. hbox2) panel. SetSizer(self. vbox) def primary_scroll(self, event): “”Controls the brightness of primary monitor””” obj = event. GetEventObject() val = obj. GetValue() system(self. cmds_primary_display[val]) def secondary_scroll(self, event): “””Controls the brightness of secondary monitor””” obj = event. GetEventObject() val = obj. GetValue() system(self. cmds_secondary_display[val]) def about_dialog(self, event): “””Shows the about message of Brightness Controller””” wx. MessageBox(self. about_me_message, ‘About’, wx. OK | wx. ICON_INFORMATION) if __name__ == ‘__main__’: app = wx. App() BrightnessController(None, title=’Brightness Controller’) app. MainLoop()

Leave a Reply

Your email address will not be published. Required fields are marked *