def __init__(self, master, arg_PinList=[('',0)]):
print 'init'
strFont= 'Arial'
self.__myfont12 = tkFont.Font(family=strFont, size=12)
self.__myfont12_Bold = tkFont.Font(family=strFont, size=12, weight= tkFont.BOLD)
self.__myfont10 = tkFont.Font(family=strFont, size=10)
self.__myfont10_Bold = tkFont.Font(family=strFont, size=10, weight= tkFont.BOLD)
self.__PinList= arg_PinList
self.__MaxRow= 7
self.__CurrentRow= len(arg_PinList)
self.__CurGridRow= self.__CurrentRow
self.__NumberList= range(0, self.__MaxRow+1)
self.__entries_Func= [0]
self.__entries_PinNumb= [0]
self.__btns_clear=[0]
#self.master= master
tkSimpleDialog.Dialog.__init__(self, master, "Peripherals")
# ########################################
python类BOLD的实例源码
def SetFontSample(self, event=None):
fontName = self.fontName.get()
fontWeight = tkFont.BOLD if self.fontBold.get() else tkFont.NORMAL
newFont = (fontName, self.fontSize.get(), fontWeight)
self.labelFontSample.config(font=newFont)
self.textHighlightSample.configure(font=newFont)
def SetFontSample(self, event=None):
fontName = self.fontName.get()
fontWeight = tkFont.BOLD if self.fontBold.get() else tkFont.NORMAL
newFont = (fontName, self.fontSize.get(), fontWeight)
self.labelFontSample.config(font=newFont)
self.textHighlightSample.configure(font=newFont)
def SetFontSample(self,event=None):
fontName=self.fontName.get()
if self.fontBold.get():
fontWeight=tkFont.BOLD
else:
fontWeight=tkFont.NORMAL
newFont = (fontName, self.fontSize.get(), fontWeight)
self.labelFontSample.config(font=newFont)
self.textHighlightSample.configure(font=newFont)
def interface():
global root
global c
global ballplay_enable
root.title("Game Interface")
c.pack()
c.create_rectangle(0,0,510,290, fill = "#00BCD4", outline = "")
c.create_rectangle(0,0, 510,30, fill = "#4682B4", outline = "")
c.create_rectangle(10, 40, 35, 44, fill = "#F5F5F5", outline = "")
c.create_rectangle(10, 47, 35, 51, fill = "#F5F5F5", outline = "")
c.create_rectangle(10, 54, 35, 58, fill = "#F5F5F5", outline = "")
c.create_oval(330,240,430,340, fill = "#FF4081", outline = "")
c.create_line(330, 290, 430, 290, fill = "white")
font1 = tkFont.Font(size = 28, family = "Roboto", weight = tkFont.BOLD, overstrike = 0)
font2 = tkFont.Font(family = 'Roboto',size = 13)
c.create_text(235, 150, text = "Bouncing Ball",font = font1, fill = "white")
c.create_text(235, 180, text = "Powered by Python", font = font2, fill = "#B2EBF2")
c.create_text(235, 360, text = "Copyright©(2016)Gao Chao\n\nchoose the mode to start", font = font2, fill = "#B6B6B6")
c.create_text(380, 275, text = "Mode-1",font = font2, fill= "white")
c.create_text(380, 305, text = "Mode-2",font = font2, fill= "white")
c.bind("<Button-1>", out)
sb = []
for i in range(5):
sb.append(c.create_oval(15 * i, 435, 15 * i + 10, 445, fill = "#00BCD4", outline = ""))
x = [5, 15, 25, 35, 45]
speed = [0, 0, 0, 0, 0]
#ball play image
while ballplay_enable == 0:
for i in range(5):
speed[i] = (abs(250 - x[i]) + 200) / 35
x[i] += speed[i]
c.move(sb[i], speed[i], 0)
c.update()
if x[0] > 480:
for i in range(5):
c.delete(sb[i])
for i in range(5):
sb[i] = c.create_oval(15 * i,435,15 * i + 10,445, fill = "#00BCD4", outline = "")
x = [5, 15, 25, 35, 45]
sleep(0.04)
root.mainloop()