Skip to content

Instantly share code, notes, and snippets.

@wanghongfei
Created June 18, 2015 15:00
Show Gist options
  • Save wanghongfei/3a4c97c6dad859f772b9 to your computer and use it in GitHub Desktop.
Save wanghongfei/3a4c97c6dad859f772b9 to your computer and use it in GitHub Desktop.
提醒自己订餐,要不明天中午没的吃了
__author__ = 'wanghongfei'
# -*- coding:utf8 -*-
import Tkinter
WIDTH = 300
HEIGHT = 200
# centralize window
def center_window(root, w, h):
# get screen width and height
ws = root.winfo_screenwidth()
hs = root.winfo_screenheight()
# calculate position x, y
x = (ws / 2) - (w / 2)
y = (hs / 2) - (h / 2)
root.geometry('%dx%d+%d+%d' % (w, h, x, y))
# create window
window = Tkinter.Tk()
window.title('赶紧订饭!!!!')
center_window(window)
label = Tkinter.Label(window, text="要不明天就饿肚子!!", bg="red", font=("Arial", 12), width=WIDTH, height=HEIGHT)
label.pack(side=Tkinter.LEFT)
window.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment