本文整理汇总了Python中ttk.Button.image方法的典型用法代码示例。如果您正苦于以下问题:Python Button.image方法的具体用法?Python Button.image怎么用?Python Button.image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttk.Button
的用法示例。
在下文中一共展示了Button.image方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initUI
# 需要导入模块: from ttk import Button [as 别名]
# 或者: from ttk.Button import image [as 别名]
#.........这里部分代码省略.........
#def update_topInd(): #TODO: change colors on playback
# while True:
# if self.play["text"] == "Pause":
# try:
# timestamp = self.player.query_position(gst.FORMAT_TIME, None)[0]/1000000000.0
# insert = bisect_right(self.topics, timestamp)
# if insert > 0 and float(self.topic_display.get("%d.0" % (insert), "%d.end" % (insert)).split('-')[1]) >= timestamp:
# #topic_indicator.configure(bg= #get color in self.topic_display at line insert
# pass
# time.sleep(.1)
# except:
# continue
# else:
# time.sleep(.2)
#self.tt = threading.Thread(target=update_topInd)
#self.tt.daemon = True
#self.tt.start()
#Done with topic
h = '44'
w = '40'
c = "top"
codemap = {
'a':'yesandquestion',
's':'interrupt',
'd':'block',
'f':'overcoming',
'q':'move',
'w':'question',
'e':'support',
'r':'yesand',
'z':'deflection',
'x':'humour',
'c':'block-support',
'v':'hesitation',
}
firstrow = 12
b1 = Button(buttongrid, image=self.imagemap[codemap['a']], command=lambda: self.update_symbols(codemap['a']), background="white", height=h, width=w, compound=c, text="A")
b1.image = self.imagemap[codemap['a']]
b1.grid(row=firstrow, column=0)
self.buttonmap['a'] = b1
b2 = Button(buttongrid, image=self.imagemap[codemap['s']], command=lambda: self.update_symbols(codemap['s']), background="white", height=h, width=w, compound=c, text="S")
b2.image = self.imagemap[codemap['s']]
b2.grid(row=firstrow, column=1)
self.buttonmap['s'] = b2
b3 = Button(buttongrid, image=self.imagemap[codemap['d']], command=lambda: self.update_symbols(codemap['d']), background="white", height=h, width=w, compound=c, text="D")
b3.image = self.imagemap[codemap['d']]
b3.grid(row=firstrow, column=2)
self.buttonmap['d'] = b3
b4 = Button(buttongrid, image=self.imagemap[codemap['f']], command=lambda: self.update_symbols(codemap['f']), background="white", height=h, width=w, compound=c, text="F")
b4.image = self.imagemap[codemap['f']]
b4.grid(row=firstrow, column=3)
self.buttonmap['f'] = b4
b5 = Button(buttongrid, image=self.imagemap[codemap['q']], command=lambda: self.update_symbols(codemap['q']), background="white", height=h, width=w, compound=c, text="Q")
b5.image = self.imagemap[codemap['q']]
b5.grid(row=firstrow+1, column=0)
self.buttonmap['q'] = b5
b6 = Button(buttongrid, image=self.imagemap[codemap['w']], command=lambda: self.update_symbols(codemap['w']), background="white", height=h, width=w, compound=c, text="W")
b6.image = self.imagemap[codemap['w']]
b6.grid(row=firstrow+1, column=1)
self.buttonmap['w'] = b6
b7 = Button(buttongrid, image=self.imagemap[codemap['e']], command=lambda: self.update_symbols(codemap['e']), background="white", height=h, width=w, compound=c, text="E")
b7.image = self.imagemap[codemap['e']]
b7.grid(row=firstrow+1, column=2)
self.buttonmap['e'] = b7
b8 = Button(buttongrid, image=self.imagemap[codemap['r']], command=lambda: self.update_symbols(codemap['r']), background="white", height=h, width=w, compound=c, text="R", font=100)
b8.image = self.imagemap[codemap['r']]
b8.grid(row=firstrow+1, column=3)
self.buttonmap['r'] = b8
b9 = Button(buttongrid, image=self.imagemap[codemap['z']], command=lambda: self.update_symbols(codemap['z']), background="white", height=h, width=w, compound=c, text="Z")
b9.image = self.imagemap[codemap['z']]
b9.grid(row=firstrow+2, column=0)
self.buttonmap['z'] = b9
b10 = Button(buttongrid, image=self.imagemap[codemap['x']], command=lambda: self.update_symbols(codemap['x']), background="white", height=h, width=w, compound=c, text="X", font=100)
b10.image = self.imagemap[codemap['x']]
b10.grid(row=firstrow+2, column=1)
self.buttonmap['x'] = b10
b11 = Button(buttongrid, image=self.imagemap[codemap['c']], command=lambda: self.update_symbols(codemap['c']), background="white", height=h, width=w, compound=c, text="C", font=100)
b11.image = self.imagemap[codemap['c']]
b11.grid(row=firstrow+2, column=2)
self.buttonmap['c'] = b11
b12 = Button(buttongrid, image=self.imagemap[codemap['v']], command=lambda: self.update_symbols(codemap['v']), background="white", height=h, width=w, compound=c, text="V", font=100)
b12.image = self.imagemap[codemap['v']]
b12.grid(row=firstrow+2, column=3)
self.buttonmap['v'] = b12
示例2: initUI
# 需要导入模块: from ttk import Button [as 别名]
# 或者: from ttk.Button import image [as 别名]
def initUI(self):
self.initText()
self.parent.title("PySAD")
self.style = Style()
self.style.theme_use("clam")
self.pack(fill=BOTH, expand=1)
barraLateral = Frame(self, borderwidth=1)
barraLateral.pack(side=RIGHT, padx=5, pady=5)
idiomaFrame = Frame(barraLateral, relief=FLAT)
idiomaFrame.pack(side=TOP)
self.espButton = Button(idiomaFrame, text="es", width=0, command=lambda: self.updateText(0))
self.espButton.grid(row=0, column=0)
self.engButton = Button(idiomaFrame, text="en", width=0, command=lambda: self.updateText(1))
self.engButton.grid(row=0, column=1)
self.updateText(0)
editarFrame = Frame(barraLateral, relief=RAISED, borderwidth=1, width=1000)
editarFrame.pack(fill=BOTH, expand=1, side=TOP, padx=5, pady=5)
self.tipoCurva = IntVar()
tituloSelector = Label(editarFrame, textvariable=self.curTip)
tituloSelector.grid(row=0,columnspan=2, padx=2, pady=4)
Radiobutton(editarFrame, textvariable=self.ArcSpi, variable=self.tipoCurva , value=1, command=self.cambiaFormula, width=17).grid(row=1,columnspan=2,sticky=W,padx=4)
Radiobutton(editarFrame, textvariable=self.LogSpi, variable=self.tipoCurva , value=2, command=self.cambiaFormula).grid(row=2,columnspan=2,sticky=W,padx=4)
self.formulaLabel = Label(editarFrame)
self.formulaLabel.grid(row=4, columnspan=2, pady=4)
Label(editarFrame,textvariable=self.aaa).grid(row=5, column=0,pady=2)
Label(editarFrame,textvariable=self.bbb).grid(row=6, column=0,pady=2)
self.labelC = Label(editarFrame,textvariable=self.ccc)
self.labelC.grid(row=7, column=0,pady=2)
self.labelC.config(state=DISABLED)
Label(editarFrame,textvariable=self.Lma).grid(row=8, column=0,pady=2)
Label(editarFrame,textvariable=self.fre).grid(row=9, column=0,pady=2)
parA = Entry(editarFrame,width=4,textvariable=self.a)
parA.grid(row=5, column=1, sticky=W)
parB = Entry(editarFrame,width=4,textvariable=self.b)
parB.grid(row=6, column=1, sticky=W)
self.parC = Entry(editarFrame,width=4,textvariable=self.c)
self.parC.grid(row=7, column=1, sticky=W)
self.parC.config(state=DISABLED)
lMax = Entry(editarFrame,width=4,textvariable=self.lMax)
lMax.grid(row=8, column=1, sticky=W)
self.createToolTip(lMax, self.stringText['LmaToo'])
frec = Entry(editarFrame,width=4,textvariable=self.frec)
frec.grid(row=9, column=1, sticky=W)
self.createToolTip(frec, self.stringText['FreToo'])
self.espejar = IntVar()
checkEspejar = Checkbutton(editarFrame, textvariable=self.Mir, variable=self.espejar, command=self.activarFuente)
checkEspejar.grid(row=10, columnspan=2, pady=2, sticky=W, padx=4)
self.createToolTip(checkEspejar, self.stringText['MirToo'])
self.fuente = IntVar()
self.checkFuente = Checkbutton(editarFrame, textvariable=self.Sou, state=DISABLED, variable=self.fuente)
self.checkFuente.grid(row=11, columnspan=2, pady=2, sticky=W, padx=4)
self.createToolTip(self.checkFuente, self.stringText['SouToo'])
okButton = Button(editarFrame, textvariable=self.Gen, command=self.regraficar)
okButton.grid(row=12, columnspan=2, pady=5)
self.createToolTip(okButton, self.stringText['GenToo'])
self.frame2 = Frame(self, borderwidth=1)
self.frame2.pack(fill=BOTH, expand=1, side=LEFT, padx=5, pady=5)
self.canvas = FigureCanvasTkAgg(self.f, master=self.frame2)
self.canvas.get_tk_widget().pack(side=TOP,fill=BOTH, expand=1, padx=10, pady=10)
frameGuardar = Frame(barraLateral, relief=FLAT, borderwidth=1)
frameGuardar.pack(fill=BOTH, expand=1, side=BOTTOM, padx=5, pady=5)
icGuardar = PhotoImage(data='''R0lGODlhEAAQAIABADMzM////yH5BAEKAAEALAAAAAAQABAAAAIlDI55wchvQJQOxontUktTbkHcSJZkGCao161N5U5SLNM1vZlOAQA7''')
saveButtonNEC = Button(frameGuardar, text=self.stringText['NEC'][0], image=icGuardar, compound=LEFT, command=self.escribirFichero, width=3)
saveButtonNEC.image = icGuardar
saveButtonNEC.grid(row=0, column=0, pady=2, padx=2, sticky=W)
self.createToolTip(saveButtonNEC, self.stringText['NECToo'])
saveButtonPDF = Button(frameGuardar, text=self.stringText['PDF'][0], image=icGuardar, compound=LEFT, command=self.escribirPDF, width=3)
saveButtonPDF.image = icGuardar
saveButtonPDF.grid(row=0, column=2, pady=2, padx=2, sticky=E)
self.createToolTip(saveButtonPDF, self.stringText['PDFToo'])
self.helpButton = Button(frameGuardar, text="?", command=self.mostrarAyuda, width=2)
self.helpButton.grid(row=0, column=3, pady=2, padx=2, sticky=E)
frame3 = Frame(barraLateral, relief=RAISED, borderwidth=1)
#.........这里部分代码省略.........