MCPcopy Create free account
hub / github.com/ActiveState/code / SplashScreen

Class SplashScreen

recipes/Python/577271_Tkinter_Splash_Screen/recipe-577271.py:18–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16from Tkinter import *
17
18class SplashScreen(Frame):
19 def __init__(self, master=None, width=0.8, height=0.6, useFactor=True):
20 Frame.__init__(self, master)
21 self.pack(side=TOP, fill=BOTH, expand=YES)
22
23 # get screen width and height
24 ws = self.master.winfo_screenwidth()
25 hs = self.master.winfo_screenheight()
26 w = (useFactor and ws*width) or width
27 h = (useFactor and ws*height) or height
28 # calculate position x, y
29 x = (ws/2) - (w/2)
30 y = (hs/2) - (h/2)
31 self.master.geometry('%dx%d+%d+%d' % (w, h, x, y))
32
33 self.master.overrideredirect(True)
34 self.lift()
35
36if __name__ == '__main__':
37 root = Tk()

Callers 1

recipe-577271.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected