Screen resolution again

Alexander Schliep schliep at Octopussy.MI.Uni-Koeln.DE
Mon Jun 10 12:11:57 CEST 2002


The following snippet centers a splash screen dialog on the screen.

class SplashScreen(Toplevel):

    ...

    def CenterOnScreen(self):
        self.update_idletasks()
        xmax = self.winfo_screenwidth()
        ymax = self.winfo_screenheight()
        x0 = (xmax - self.winfo_reqwidth()) / 2
        y0 = (ymax - self.winfo_reqheight()) / 2
        self.geometry("+%d+%d" % (x0, y0))


This works on Windows, Linux, MacOS X ...

Cheers,
Alexander

-- 
Alexander Schliep                    schliep at zpr.uni-koeln.de



More information about the Python-list mailing list