当前位置: 首页>>代码示例>>Python>>正文


Python Label.set方法代码示例

本文整理汇总了Python中tkinter.Label.set方法的典型用法代码示例。如果您正苦于以下问题:Python Label.set方法的具体用法?Python Label.set怎么用?Python Label.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tkinter.Label的用法示例。


在下文中一共展示了Label.set方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TagoutBeta

# 需要导入模块: from tkinter import Label [as 别名]
# 或者: from tkinter.Label import set [as 别名]
class TagoutBeta(Frame):

    def __init__(self, parent):
        Frame.__init__(self, parent, background="black")
        self.parent = parent
        self.parent.title("TAGOUT")
        self.style = ttk.Style()
        self.style.theme_use("default")
        self.centreWindow()
        self.pack(fill=BOTH, expand=1)
        

# Barra de Menu

        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)
        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Exit", command=self.destroy)
        menubar.add_cascade(label="File", menu=fileMenu)

        
#Campos de exibição
        
        datetime.datetime.now()
    
        self.lbltimeVar = StringVar()
        self.lbltimeVar.set(datetime.datetime.strftime(datetime.datetime.now(), '%d-%m-%Y %H-%M-%S'))
        Label(self, textvariable=self.lbltimeVar).grid(
            row=1, column=2, sticky=W)   # a reference to the label is not retained

        self.lblnomeVar = StringVar()
        self.lblnomeVar.set("NOME")
        Label(self, textvariable=self.lblnomeVar).grid(
            row=2, column=5, sticky=N)   # a reference to the label is not retained

        self.nomeVar = StringVar()
        self.nomeVar.set("joão bosco da silva")
        Label(self, textvariable=self.nomeVar).grid(
            row=3, column=5, sticky=W+E)   # a reference to the label is not retained

        self.lbltagVar = StringVar()
        self.lbltagVar.set("TAG")
        Label(self, textvariable=self.lbltagVar).grid(
            row=4, column=5, sticky=N)   # a reference to the label is not retained

        self.tagVar = StringVar()
        self.tagVar.set("189.186.63.44.20")
        Label(self, textvariable=self.tagVar).grid(
            row=5, column=5, sticky=W+E)   # a reference to the label is not retained
        
        self.lblendereco = StringVar()
        self.lblendereco.set("Endereço")
        Label(self, textvariable=self.lblendereco).grid(
            row=6, column=5, sticky=N)   # a reference to the label is not retained

        self.enderecoVar = StringVar()
        self.enderecoVar.set("apt 202 bloco 13")
        Label(self, textvariable=self.enderecoVar).grid(
            row=7, column=5, sticky=W+E)   # a reference to the label is not retained
        
#Botões de ação        

        manBtn = Button(self, text="MANUT.", width=10, command=self.maintenance)
        manBtn.grid(row=8, column=2, padx=5, pady=3, sticky=W+E)
        listBtn = Button(self, text="Lista", width=10, command=self.quit)
        listBtn.grid(row=8, column=6, padx=5, pady=3, sticky=W+E)

#Centraliza a janela   

    def centreWindow(self):
        w = 300
        h = 300
        sw = self.parent.winfo_screenwidth()
        sh = self.parent.winfo_screenheight()
        x = (sw - w)/2
        y = (sh - h)/2
        self.parent.geometry('%dx%d+%d+%d' % (w, h, x, y))

#Instancia que inicia a tela de manutenção


    def maintenance(self, master=None):
        
        
        self.fonte = ("Verdana", "8")
        self.container1 = Frame(master)
        self.container1["pady"] = 10
        self.container1.pack()
        self.container2 = Frame(master)
        self.container2["padx"] = 20
        self.container2["pady"] = 5
        self.container2.pack()
        self.container3 = Frame(master)
        self.container3["padx"] = 20
        self.container3["pady"] = 5
        self.container3.pack()
        self.container4 = Frame(master)
        self.container4["padx"] = 20
        self.container4["pady"] = 5
        self.container4.pack()
#.........这里部分代码省略.........
开发者ID:phods,项目名称:tagout,代码行数:103,代码来源:testejanela.py


注:本文中的tkinter.Label.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。