• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ttk.Label类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: initUI

	def initUI(self):

		self.parent.title("Windows")
		self.style = Style()
		self.style.theme_use("default")
		self.pack(fill=BOTH, expand=1)

		#	Configures padding between items in application
		self.columnconfigure(1, weight=1)
		self.columnconfigure(3, pad=7)
		self.rowconfigure(3, weight=1)
		self.rowconfigure(5, pad=7)

		self.lbl = Label(self, text="Windows")
		self.lbl.grid(sticky=W, pady=4, padx=5)

		self.area = Label(self)
		#	Column and row span make box go to that column/row
		self.area.grid(row=1, column=0, columnspan=2, rowspan=4, padx=5, sticky=E+W+S+N)

		self.abtn = Button(self, text="Connect", command = self.connect)
		# self.abtn["command"] = update_box()
		self.abtn.grid(row=1, column=3)

		self.cbtn = Button(self, text="Close")
		self.cbtn.grid(row=2, column=3, pady=4)

		self.hbtn = Button(self, text="Help")
		self.hbtn.grid(row=5, column=0, padx=5)

		self.obtn = Button(self, text="Open")
		self.obtn.grid(row=5, column=3)
开发者ID:Bobby-Schmidt,项目名称:OBD2-Scanner,代码行数:32,代码来源:position_tut.py


示例2: initUI

    def initUI(self):

        self.parent.title("Paste IP's Here:")
        self.style = Style()
        self.style.theme_use("aqua")
        self.pack(fill=BOTH, expand=1)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)

        lbl = Label(self, text="Paste IP's Here:")
        lbl.grid(sticky=W, pady=4, padx=5)

        area = Text(self)
        area.grid(row=1, column=0, columnspan=2, rowspan=4,
            padx=5, sticky=E+W+S+N)

        abtn = Button(self, text="Open", command=self.onOpen())
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Close")
        cbtn.grid(row=2, column=3, pady=4)

        hbtn = Button(self, text="Help")
        hbtn.grid(row=5, column=0, padx=5)

        obtn = Button(self, text="OK")
        obtn.grid(row=5, column=3)
开发者ID:Cyber-Forensic,项目名称:Telize-GeoIP-API,代码行数:30,代码来源:GeoIp-GUI.py


示例3: TabServices

class TabServices(Frame):

    def __init__(self, parent, txt=dict()):
        """Instanciating the output workbook."""
        self.parent = parent
        Frame.__init__(self)

        # variables
        self.url_srv = StringVar(self,
                                 'http://suite.opengeo.org/geoserver/wfs?request=GetCapabilities')

        # widgets
        self.lb_url_srv = Label(self,
                                text='Web service URL GetCapabilities: ')
        self.ent_url_srv = Entry(self,
                                 width=75,
                                 textvariable=self.url_srv)
        self.btn_check_srv = Button(self, text="youhou")
        # widgets placement
        self.lb_url_srv.grid(row=0, column=0,
                             sticky="NSWE", padx=2, pady=2)
        self.ent_url_srv.grid(row=0, column=1,
                              sticky="NSWE", padx=2, pady=2)
        self.btn_check_srv.grid(row=0, column=2,
                                sticky="NSWE", padx=2, pady=2)
开发者ID:Guts,项目名称:DicoGIS,代码行数:25,代码来源:tab_geoservices.py


示例4: initUI

    def initUI(self):
      
        self.parent.title("Review")
        self.pack(fill=BOTH, expand=True)
        
        frame1 = Frame(self)
        frame1.pack(fill=X)
        
        lbl1 = Label(frame1, text="Your Speed Is:", width=18, font=("Helvetica", 16))
        lbl1.pack(padx=5, pady=5)           
        
        frame2 = Frame(self)
        frame2.pack(fill=X)
        
        mph = Label(frame2, text="MPH", width=6, font=("Helvetica", 20))
        mph.pack(side=RIGHT, padx=5, pady=5)        

        self.speed_text = StringVar()
        speed_label = Label(frame2, textvariable = self.speed_text, width = 18, font=("Helvetica", 60))
        speed_label.pack(fill=X, padx=5, expand=True)
        
        frame3 = Frame(self)
        frame3.pack(fill=BOTH, expand=True)

        self.v = StringVar()
        self.v.set("Late For Class?")
        self.speed = Label(frame3, textvariable=self.v, width=16, font=("Helvetica", 40))
        self.speed.pack(padx=5, pady=5)
开发者ID:acasallas,项目名称:the-human-speed-limit,代码行数:28,代码来源:hallway_speed.py


示例5: initUI

    def initUI(self):
        self.parent.title("windows widget")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill= BOTH, expand=1)

        self.columnconfigure(1,weight=1)
        self.columnconfigure(3,pad=7)
        self.rowconfigure(3,weight=1)
        self.rowconfigure(5,pad=7)

        lbl = Label(self, text = "Windows")
        lbl.grid(sticky = W, pady=4, padx=5)

        area = Text(self)
        area.grid(row=1, column=0, columnspan=3, rowspan=4, padx=5, sticky = E+W+S+N)
        abtn = Button(self, text="Activate")
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Close")
        cbtn.grid(row=2, column=3, pady=4)

        hbtn = Button(self, text="Help")
        hbtn.grid(row=5, column=0, padx=5)

        obtn = Button(self, text = "OK")
        obtn.grid(row=5, column=3)
开发者ID:shikhagarg0192,项目名称:Python,代码行数:27,代码来源:gui9.py


示例6: CommAdd

class CommAdd(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
    def initUI(self):
        # This should be different if running on Windows....
        content = pyperclip.paste()
        print content  
        self.entries_found = []

        self.parent.title("Add a new command card")
        self.style = Style()
        self.style.theme_use("default")        
        self.pack()
        
        self.new_title_label = Label(self, text="Title")
        self.new_title_label.grid(row=0, columnspan=2)
        self.new_title_entry = Entry(self, width=90)
        self.new_title_entry.grid(row=1, column=0)
        self.new_title_entry.focus()
        self.new_content_label = Label(self, text="Card")
        self.new_content_label.grid(row=2, columnspan=2)
        self.new_content_text = Text(self, width=110, height=34)
        self.new_content_text.insert(END, content)
        self.new_content_text.grid(row=3, columnspan=2)
        self.add_new_btn = Button(self, text="Add New Card", command=self.onAddNew)
        self.add_new_btn.grid(row=4)

    def onAddNew(self):

        pass
开发者ID:angelalonso,项目名称:comm,代码行数:35,代码来源:comm.py


示例7: __init__

    def __init__(self, master, track, sequencer):
        TrackFrame.__init__(self, master, track)

        self.id_label = Label(self, text=str(track.id))
        self.id_label.pack(side='left')

        self.instrument_label = Label(self, text=str(track.instrument_tone), width=3)
        self.instrument_label.pack(side='left')

        mute_var = IntVar()

        self.mute_toggle = Checkbutton(self, command=lambda: check_cmd(track, mute_var), variable=mute_var)
        self.mute_toggle.pack(side='left')

        mute_var.set(not track.mute)

        rhythm_frame = Frame(self)
        rhythm_frame.pack(side='right')

        subdivision = sequencer.measure_resolution / sequencer.beats_per_measure

        self.buttons = []

        for b in range(0, len(self.track.rhythms)):
            button = RhythmButton(rhythm_frame, track, b, not b % subdivision)
            self.buttons.append(button)
            button.grid(row=0, column=b, padx=1)

        self.beat = 0
开发者ID:ladsmund,项目名称:msp_group_project,代码行数:29,代码来源:track_frame.py


示例8: initUI

    def initUI(self):
        self.parent.title("Windows")
        self.pack(fill=BOTH, expand=True)

        self.columnconfigure(1, weight=1)
        self.columnconfigure(3, pad=7)
        self.rowconfigure(3, weight=1)
        self.rowconfigure(5, pad=7)

        lbl = Label(self, text="Windows")
        lbl.grid(sticky=W, pady=4, padx=5)

        area = Text(self)
        area.grid(row=1, column=0, columnspan=2, rowspan=4)

        abtn = Button(self, text="Activate")
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Close")
        cbtn.grid(row=2, column=3, pady=4)

        hbtn = Button(self, text="Help")
        hbtn.grid(row=5, column=0, padx=5)

        obtn = Button(self, text="OK")
        obtn.grid(row=5, column=3)
开发者ID:Exodus111,项目名称:Projects,代码行数:26,代码来源:windows.py


示例9: Example

class Example(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()

    def initUI(self):
        self.parent.title("ListBox")
        self.pack(fill=BOTH, expand=1)

        eagles = ["Sam Bradford", "Jordan Matthews", "LeBron James", "Donnie Jones"]
        lb = Listbox(self)
        for i in eagles:
            lb.insert(END, i)

        lb.bind("<<ListboxSelect>>", self.onSelect)
        lb.pack(pady=15)

        self.var = StringVar()
        self.label = Label(self, text=0, textvariable=self.var)
        self.label.pack()

    def onSelect(self, val):
        sender = val.widget
        idx = sender.curselection()
        value = sender.get(idx)
        self.var.set(value)
开发者ID:belargej,项目名称:PythonProjects,代码行数:27,代码来源:ListBox1.py


示例10: Example

class Example(Frame):
  
    def __init__(self, parent):
        Frame.__init__(self, parent)   
         
        self.parent = parent        
        self.initUI()
        
        
    def initUI(self):
      
        self.parent.title("Scale")
        self.style = Style()
        self.style.theme_use("default")        
        
        self.pack(fill=BOTH, expand=1)

        scale = Scale(self, from_=0, to=100, 
            command=self.onScale)
        scale.pack(side=LEFT, padx=15)

        self.var = IntVar()
        self.label = Label(self, text=0, textvariable=self.var)        
        self.label.pack(side=LEFT)
        

    def onScale(self, val):

        v = int(float(val))
        self.var.set(v)
开发者ID:kingraijun,项目名称:zetcode-tuts,代码行数:30,代码来源:scale.py


示例11: setupUI

    def setupUI(self):
        self.master.title("Markwhat")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)
        self.grid_columnconfigure(0, weight=1)
        self.grid_columnconfigure(1, weight=1)
        self.rowconfigure(1, weight=1)

        self.markwhat_label = Label(self, text="Markwhat")
        self.markwhat_label.grid(sticky=W, row=0, column=0)

        self.markwhat_textarea = WhatText(self, background='white')
        self.markwhat_textarea.grid(row=1, column=0, sticky=NSEW)
        self.markwhat_textarea.beenModified = self.on_markwhat_modfified

        self.markup_label = Label(self, text="Markup")
        self.markup_label.grid(sticky=W, row=0, column=1)

        self.markup_preview = HtmlFrame(self)
        self.markup_preview.grid(row=1, column=1, sticky=NSEW)

        self.preview_button_text = StringVar()
        self.preview_button = Button(
            self,
            textvariable=self.preview_button_text,
            command=self.on_preview_click,
        )
        self.preview_button_text.set('HTML')
        self.preview_button.grid(row=2, column=1, sticky=W)
开发者ID:Alir3z4,项目名称:markwhat,代码行数:30,代码来源:main_window.py


示例12: initUI

    def initUI(self):

        self.parent.title("Listbox + Scale + ChkBtn")
        self.pack(fill=BOTH, expand=1)
        acts = ['Scarlett Johansson', 'Rachel Weiss',
            'Natalie Portman', 'Jessica Alba']

        lb = Listbox(self)
        for i in acts:
            lb.insert(END, i)

        lb.bind("<<ListboxSelect>>", self.onSelect)
        lb.place(x=20, y=20)

        self.var = StringVar()
        self.label = Label(self, text=0, textvariable=self.var)
        self.label.place(x=20, y=190)

        scale = Scale(self, from_=0, to=100, command=self.onScale)
        scale.place(x=20, y=220)

        self.var_scale = IntVar()
        self.label_scale = Label(self, text=0, textvariable=self.var_scale)
        self.label_scale.place(x=180, y=220)

        self.var_chk = IntVar()
        cb = Checkbutton(self, text="Test", variable=self.var_chk,
                command=self.onClick)
        cb.select()
        cb.place(x=220, y=60)
开发者ID:,项目名称:,代码行数:30,代码来源:


示例13: initUI

    def initUI(self):
        # Set the name of the UI window
        self.parent.title("Bennington File System Client")
        # Set the style using the default theme
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        # Set the "Open File" options
        self.file_opt = options = {}
        # Allow for any file to be choosable
        options["defaultextension"] = ""
        options["filetypes"] = ""
        # Set the directory window will open up to initially
        options["initialdir"] = "C:\\"
        options["parent"] = self

        # Create a label object which holds the text labeling the listbox
        lbl = Label(self, text="Bennington File System Files List", foreground="black")
        # Place the text in the top left
        lbl.grid(column=0, row=0, pady=4, padx=5)

        # Create the listbox, which will contain a list of all the files on the system
        self.area = Listbox(self, height=20)
        # Place the lisbox in the UI frame
        self.area.grid(row=1, column=0, columnspan=1, rowspan=10, padx=5, sticky=N + W + E + S)

        # Ask the master server which files it has, then populate the listbox with the response
        self.getFiles()

        # Create a button labeled 'Upload', and bind the uploadFile() function to it
        uploadbtn = Button(self, text="Upload", command=self.uploadFile)
        # Place the button in the UI frame
        uploadbtn.grid(row=1, column=3)

        # Create a button labeled 'Download', and bind the downloadFile() function to it
        dwnbtn = Button(self, text="Download", command=self.downloadFile)
        # Place the button in the UI frame
        dwnbtn.grid(row=2, column=3)

        # Create a button labeled 'Delete', and bind the deleteFile() function to it
        delbtn = Button(self, text="Delete", command=self.deleteFile)
        # Place the button in the UI frame
        delbtn.grid(row=3, column=3)

        # Create a button labeled 'Undelete', and bind the undeleteFile() function to it
        undelbtn = Button(self, text="Undelete", command=self.undeleteFile)
        # Place the button in the UI frame
        undelbtn.grid(row=4, column=3)

        # Create a button labeled 'Refresh List', and bind the getFiles() function to it
        refbtn = Button(self, text="Refresh List", command=self.getFiles)
        # Place the button in the UI frame
        refbtn.grid(row=5, column=3)

        # Create a button labeled 'Quit', and bind the exitProgram() function to it
        quitButton = Button(self, text="Quit", command=self.exitProgram)
        # Place the button in the UI frame
        quitButton.grid(sticky=W, padx=5, pady=4)
开发者ID:BenningtonCS,项目名称:GFS,代码行数:59,代码来源:newclient.py


示例14: __init__

    def __init__(self,topwin,argv,**kwargs):
        global text_font
        self.topwin = topwin
        self.filefolder = 'log/'
        if len(argv) > 1: self.filefolder = argv[1]
        self.thread_status = 'Ready:'
        set_winicon(self.topwin,'icon_grey')

        self.frame3 = Frame(self.topwin, width=700,height=40, relief=SUNKEN)
        self.frame3.pack_propagate(0)
        self.frame3.pack(side=BOTTOM,pady=10)
        self.frame1 = Frame(self.topwin, width=150,height=460, relief=SUNKEN)
        self.frame1.pack_propagate(0)
        self.frame1.pack(side=LEFT,padx=10,pady=10)
        self.frame2 = Frame(self.topwin, width=550,height=460, relief=SUNKEN)
        self.frame2.pack_propagate(0)
        self.frame2.pack(side=LEFT,padx=10,pady=10)
        self.frame4 = Frame(self.frame3, width=450,height=40, relief=SUNKEN)
        self.frame4.pack_propagate(0)
        self.frame4.pack(side=RIGHT)

        self.label1 = Label(self.frame1,text='Files:')
        self.label1.pack(side=TOP)
        self.Fscroll = Scrollbar(self.frame1)
        self.Fscroll.pack(side=RIGHT, fill=Y, expand=NO)
        self.listbox = Listbox(self.frame1)
        self.listbox.pack(expand=1, fill="both")
        self.Fscroll.configure(command=self.listbox.yview)
        self.listbox.configure(yscrollcommand=self.Fscroll.set)

        self.Tbox = Text(self.frame2, height=12, width=40,wrap=WORD)
        self.Tbox.tag_configure('blackcol', font=text_font, foreground='black')
        self.Tbox.tag_configure('redcol', font=text_font, foreground='red')
        self.Tbox.configure(inactiveselectbackground="#6B9EB7", selectbackground="#4283A4")
        self.Tbox.tag_raise("sel")
        self.Tscroll = Scrollbar(self.frame2)
        self.Tbox.focus_set()
        self.Tbox.config(yscrollcommand=self.Tscroll.set)
        self.Tscroll.config(command=self.Tbox.yview)
        self.Tscroll.pack(side=RIGHT, fill=Y)
        self.Tbox.pack(side=BOTTOM,fill=BOTH,expand=1)

        self.loadLabel = Label(self.frame3,text='Ready:')
        self.loadLabel.pack(side=LEFT,padx=30)
        bb1 = Button(self.frame4, text='Change folder', command=self.load_other_folder)
        bb1.pack(side=LEFT,padx=30)
        bb2 = Button(self.frame4, text='Save', command=self.save_file)
        bb2.pack(side=LEFT)
        bb3 = Button(self.frame4, text='Close', command=self.close_func)
        bb3.pack(side=LEFT,padx=30)

        self.reload_file_list()
        self.topwin.bind('<Escape>', self.close_func)
        self.topwin.bind("<Control-a>", lambda x: widget_sel_all(self.Tbox))
        self.Tbox.bind('<Control-f>',lambda x: search_text_dialog(self.Tbox,self.Tscroll))
        self.listbox.bind('<Button-1>', lambda x: self.topwin.after(20,self.file_loader))
        self.topwin.protocol('WM_DELETE_WINDOW', self.close_func)
        self.topwin.after(200,self.after_task)
        self.colortag()
开发者ID:Bakterija,项目名称:iSPTC,代码行数:59,代码来源:editor.py


示例15: MainFrame

class MainFrame(Frame):    
    def __init__(self, parent):
        Frame.__init__(self, parent)   
        self.parent = parent
        self.initUI()    
              
    def initUI(self):
        self.parent.title("Driver Control Panel")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        self.label = Label(self, text="Bus Tracker - Driver", font=('Helvetica', '21'))
        self.label.grid(row=0, column=0)

        self.l = Label(self, text="Bus Line", font=('Helvetica', '18'))
        self.l.grid(row=1, column=0)
        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=2, column=0)

        self.l = Label(self, text="Direction", font=('Helvetica', '18'))
        self.l.grid(row=3, column=0)

        # add vertical space
        self.l = Label(self, text="", font=('Helvetica', '14'))
        self.l.grid(row=5, column=0)

        self.e = Entry(self, font=('Helvetica', '18'))
        self.e.grid(row=4, column=0)
        self.search = Button(self, text="Start")
        self.search.grid(row=6, column=0)   
        
        
        ######### used for debug ##########
        # add vertical space
        self.l2 = Label(self, text="", font=('Helvetica', '14'))
        self.l2.grid(row=5, column=0)
        
        self.turnOnBtn = Button(self, text="Turn On")
        self.turnOnBtn["command"] = self.turnOn 
        self.turnOnBtn.grid(row=6, column=0)    
        
        self.startBtn = Button(self, text="Start")
        self.startBtn["command"] = self.start 
        self.startBtn.grid(row=7, column=0)    
        
        self.turnOffBtn = Button(self, text="Turn Off")
        self.turnOffBtn["command"] = self.turnOff 
        self.turnOffBtn.grid(row=8, column=0)   
        
    def turnOn(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"turnOn", "busId":DRIVERID, "localIP":IP, "localPort":int(PORT)})
        
    def start(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"start", "route":ROUTNO, "direction":"north", "location":(0,0)})
        
    def turnOff(self):
        host.enqueue({"SM":"DRIVER_SM", "action":"turnOff"})    
开发者ID:Tianwei-Li,项目名称:DS-Bus-Tracker,代码行数:58,代码来源:gui_driver.py


示例16: Login

class Login(Frame):
    """******** Funcion: __init__ **************
    Descripcion: Constructor de Login
    Parametros:
    self Login
    parent Tk
    Retorno: void
    *****************************************************"""
    def __init__(self, parent):
        Frame.__init__(self, parent)
        self.parent = parent
        self.initUI()


    """******** Funcion: initUI **************
    Descripcion: Inicia la interfaz grafica de un Login,
                para ello hace uso de Frames y Widgets.
    Parametros:
    self Login
    Retorno: void
    *****************************************************"""
    def initUI(self):
        self.parent.title("Pythagram: Login")
        self.style = Style()
        self.style.theme_use("default")

        self.frame = Frame(self, relief=RAISED)
        self.frame.pack(fill=BOTH, expand=1)
        self.instructions = Label(self.frame,text="A new Web Browser window will open, you must log-in and accept the permissions to use this app.\nThen you have to copy the code that appears and paste it on the next text box.")
        self.instructions.pack(fill=BOTH, padx=5,pady=5)
        self.codeLabel = Label(self.frame,text="Code:")
        self.codeLabel.pack(fill=BOTH, padx=5,pady=5)
        self.codeEntry = Entry(self.frame)
        self.codeEntry.pack(fill=BOTH, padx=5,pady=5)
        self.pack(fill=BOTH, expand=1)

        self.closeButton = Button(self, text="Cancel", command=self.quit)
        self.closeButton.pack(side=RIGHT, padx=5, pady=5)
        self.okButton = Button(self, text="OK", command=self.login)
        self.okButton.pack(side=RIGHT)

    """******** Funcion: login **************
    Descripcion: Luego que el usuario ingresa su codigo de acceso, hace
                la solicitud al servidor para cargar su cuenta en una
                ventana de tipo Profile
    Parametros:
    self
    Retorno: Retorna...
    *****************************************************"""
    def login(self):
        code = self.codeEntry.get()
        api = InstagramAPI(code)
        raw = api.call_resource('users', 'info', user_id='self')
        data = raw['data']
        self.newWindow = Toplevel(self.parent)
        global GlobalID
        GlobalID = data['id']
        p = Profile(self.newWindow,api,data['id'])
开发者ID:ncyrcus,项目名称:tareas-lp,代码行数:58,代码来源:gui.py


示例17: pack_text

    def pack_text(self, text, frame=None):
    	"""adds some label text in the desired location"""

        if frame is None:
    	    label = Label(self.window, text=text)
        else:
            label = Label(frame, text=text)

        label.pack()
开发者ID:ncsurobotics,项目名称:acoustics,代码行数:9,代码来源:gui_lib.py


示例18: MainWindow

class MainWindow(Frame):
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.setupUI()

    def setupUI(self):
        self.master.title("Markwhat")
        self.style = Style()
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)
        self.grid_columnconfigure(0, weight=1)
        self.grid_columnconfigure(1, weight=1)
        self.rowconfigure(1, weight=1)

        self.markwhat_label = Label(self, text="Markwhat")
        self.markwhat_label.grid(sticky=W, row=0, column=0)

        self.markwhat_textarea = WhatText(self, background='white')
        self.markwhat_textarea.grid(row=1, column=0, sticky=NSEW)
        self.markwhat_textarea.beenModified = self.on_markwhat_modfified

        self.markup_label = Label(self, text="Markup")
        self.markup_label.grid(sticky=W, row=0, column=1)

        self.markup_preview = HtmlFrame(self)
        self.markup_preview.grid(row=1, column=1, sticky=NSEW)

        self.preview_button_text = StringVar()
        self.preview_button = Button(
            self,
            textvariable=self.preview_button_text,
            command=self.on_preview_click,
        )
        self.preview_button_text.set('HTML')
        self.preview_button.grid(row=2, column=1, sticky=W)

    def on_markwhat_modfified(self, event):
        text = self.markwhat_textarea.get('1.0', END)
        markup_text = parse_markdown(text)

        if isinstance(self.markup_preview, HtmlFrame):
            self.markup_preview.set_content(markup_text)
        else:
            self.markup_preview.delete('1.0', END)
            self.markup_preview.insert('1.0', markup_text)

    def on_preview_click(self):
        if isinstance(self.markup_preview, HtmlFrame):
            self.markup_preview = WhatText(self, background="white")
            self.preview_button_text.set('HTML')
        else:
            self.markup_preview = HtmlFrame(self)
            self.preview_button_text.set('HTML Source')

        self.markup_preview.grid(row=1, column=1, sticky=NSEW)
        self.on_markwhat_modfified(None)
开发者ID:Alir3z4,项目名称:markwhat,代码行数:57,代码来源:main_window.py


示例19: open_file_handler

def open_file_handler():
    global file1
    file1= askopenfilename()
    print file1
    captn = Label( top, text=file1, foreground="red")
    #captn.pack(side=TOP)
    captn.grid(row=3)
    #file2=str(file1)
    return file1
开发者ID:neenurose,项目名称:main-project,代码行数:9,代码来源:graphui.py


示例20: gui

class gui(Frame):
    def __init__(self,master=Tk()):
        Frame.__init__(self,master)
        self.grid()
        self.image = Image.open("test.jpg")
        self.photo = PhotoImage(self.image)
        self.label = Label(master,image=self.photo)
        self.label.image = photo
        self.label.pack()
开发者ID:codybe,项目名称:whiteboarder,代码行数:9,代码来源:GUI.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ttk.Notebook类代码示例发布时间:2022-05-27
下一篇:
Python ttk.Frame类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap