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


Python scrolledtext.ScrolledText类代码示例

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


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

示例1: addContactView

    def addContactView(self):
        window = Toplevel()
        window.focus_set()
        window.title("Add Contact")
        window.resizable(width=FALSE, height=FALSE)

        Label(window, text="Name ").grid(row=0, column=0)
        name = Entry(window, width=30)
        name.grid(row=0, column=1)

        Label(window, text="Line ").grid(row=1, column=0)
        line = Entry(window, width=30)
        line.grid(row=1, column=1)

        Label(window, text="Email ").grid(row=2, column=0)
        Email = Entry(window, width=30)
        Email.grid(row=2, column=1)

        Label(window, text="Phone ").grid(row=3, column=0)
        phone = ScrolledText(window, width=37)
        phone.grid(row=3, column=1)

        okButton = Button(window, text="Finish",
                          command=lambda: self.addContact(window, name=name.get(), line=line.get(), Email=Email.get(),
                                                          Telephone=phone.get(1.0, END)))
        okButton.grid(row=4)
        cancelButton = Button(window, text="Cancel", command=window.destroy)
        cancelButton.grid(row=4, column=1, sticky=E)
开发者ID:FCUIECSHomework,项目名称:Contact_Python,代码行数:28,代码来源:GUI.py

示例2: __init__

    def __init__(self, master=None, **kwargs):
        """
        Constructor.

        Get default settings from user's IDLE configuration.
        """
        currentTheme = idleConf.CurrentTheme()
        textcf = dict(
            padx=5,
            wrap="word",
            undo="True",
            foreground=idleConf.GetHighlight(currentTheme, "normal", fgBg="fg"),
            background=idleConf.GetHighlight(currentTheme, "normal", fgBg="bg"),
            highlightcolor=idleConf.GetHighlight(currentTheme, "hilite", fgBg="fg"),
            highlightbackground=idleConf.GetHighlight(currentTheme, "hilite", fgBg="bg"),
            insertbackground=idleConf.GetHighlight(currentTheme, "cursor", fgBg="fg"),
            width=idleConf.GetOption("main", "EditorWindow", "width"),
            height=idleConf.GetOption("main", "EditorWindow", "height"),
        )
        fontWeight = "normal"
        if idleConf.GetOption("main", "EditorWindow", "font-bold", type="bool"):
            fontWeight = "bold"
        textcf["font"] = (
            idleConf.GetOption("main", "EditorWindow", "font"),
            idleConf.GetOption("main", "EditorWindow", "font-size"),
            fontWeight,
        )
        # override defaults with any user-specified settings
        textcf.update(kwargs)
        ScrolledText.__init__(self, master, **textcf)
开发者ID:Nivgov,项目名称:AvodatGemer,代码行数:30,代码来源:gui.py

示例3: build_widgets

 def build_widgets(self):
     "Build the various widgets that will be used in the program."
     # Create processing frame widgets.
     self.processing_frame = LabelFrame(self, text='Processing Mode:')
     self.mode_var = StringVar(self, 'encode')
     self.decode_button = Radiobutton(self.processing_frame,
                                      text='Decode Cipher-Text',
                                      command=self.handle_radiobuttons,
                                      value='decode',
                                      variable=self.mode_var)
     self.encode_button = Radiobutton(self.processing_frame,
                                      text='Encode Plain-Text',
                                      command=self.handle_radiobuttons,
                                      value='encode',
                                      variable=self.mode_var)
     self.freeze_var = BooleanVar(self, False)
     self.freeze_button = Checkbutton(self.processing_frame,
                                      text='Freeze Key & Primer',
                                      command=self.handle_checkbutton,
                                      offvalue=False,
                                      onvalue=True,
                                      variable=self.freeze_var)
     # Create encoding frame widgets.
     self.encoding_frame = LabelFrame(self, text='Encoding Options:')
     self.chain_size_label = Label(self.encoding_frame, text='Chain Size:')
     self.chain_size_entry = Entry(self.encoding_frame)
     self.plain_text_label = Label(self.encoding_frame, text='Plain-Text:')
     self.plain_text_entry = Entry(self.encoding_frame)
     # Create input frame widgets.
     self.input_frame = LabelFrame(self, text='Input Area:')
     self.input_text = ScrolledText(self.input_frame, **self.TEXT)
     # Create output frame widgets.
     self.output_frame = LabelFrame(self, text='Output Area:')
     self.output_text = ScrolledText(self.output_frame, **self.TEXT)
开发者ID:jacob-carrier,项目名称:code,代码行数:34,代码来源:recipe-578076.py

示例4: receivePrivateChat

 def receivePrivateChat(self, connectingUser):
     global conversationBoxList
     print("CHAT PRIVATA in arrivo con "+connectingUser)
         
     newWindow = Toplevel(self.parent)
     newWindow.title("Python Chat requested by "+connectingUser)
     newWindow.minsize(400, 475)
     newWindow.focus()
     
     def disconnectPM():
         del conversationBoxList[connectingUser]
         newWindow.destroy()
     newWindow.protocol('WM_DELETE_WINDOW', disconnectPM)
     
     #label = Label(newWindow, text="PROVA PROVA")
     #label.pack(side="top", fill="both", padx=10, pady=10)
     frame = Frame(newWindow)
     frame.pack(fill=BOTH, expand=1, side=LEFT)
     
     box = ScrolledText(frame, wrap=WORD, relief = GROOVE, width=30, height=18, font=self.customFontMessage)
     box.config(state=DISABLED)
     box.pack(expand="yes", fill=BOTH, side=TOP)
     
     textarea = Text(frame, width=30, height=5)
     textarea.bind("<KeyRelease-Return>", lambda event : self.getprivatetext(event, textarea, connectingUser)) 
     textarea.pack(expand="yes", fill=BOTH, side=TOP)
     
     #aggiungo alla mappa globale il box di conversazione
     conversationBoxList[connectingUser] = box
开发者ID:skimdz86,项目名称:Utilities,代码行数:29,代码来源:BlinkingChatGUIMultiClient.py

示例5: build

    def build(self, frm):
        # layout of the gui elements
        frm.grid(column=0, row=0, sticky=(tk.N, tk.W, tk.E, tk.S))
        frm.columnconfigure(0, weight=1)
        frm.columnconfigure(1, weight=2)
        frm.rowconfigure(0, weight=1)

        self.scrollmsg = ScrolledText(frm, wrap=tk.WORD, width=40)
        self.scrollmsg.grid(column=0, row=1, sticky="EW")
        self.scrollmsg.tag_config('bold', font=('Courier',10,'bold'))
        
        self.scrolldata = ScrolledText(frm, wrap=tk.WORD, width=40)
        self.scrolldata.grid(column=1, row=1, rowspan=9, sticky="NS")
        self.scrolldata.tag_config('bold', font=('Courier',10,'bold'))
        
        self.entrytext = tk.StringVar()
        self.entry = ttk.Entry(frm, textvariable=self.entrytext)
        self.entry.grid(column=0, row=3, sticky='EW')
        self.entry.bind("<Return>", self.on_press_enter)

        btn_quit = ttk.Button(frm, text="QUIT",
                            command=self.finish)
        btn_quit.grid(column=0,
                            row=9, sticky="EW")

        for child in frm.winfo_children():
            child.grid_configure(padx=5, pady=5)
            
        self.entry.focus_set() # set the focus on the entry field
开发者ID:hans-boden,项目名称:hans-boden.github.io,代码行数:29,代码来源:text_gui.py

示例6: __init__

    def __init__(self, master=None, **kwargs):
        """
        Initializer.

        Get default settings from user's IDLE configuration.
        """
        currentTheme = idleConf.CurrentTheme()
        textcf = {
            'padx': 5,
            'wrap': 'word',
            'undo': 'True',
            'foreground': idleConf.GetHighlight(
                currentTheme, 'normal', fgBg='fg'),
            'background': idleConf.GetHighlight(
                currentTheme, 'normal', fgBg='bg'),
            'highlightcolor': idleConf.GetHighlight(
                currentTheme, 'hilite', fgBg='fg'),
            'highlightbackground': idleConf.GetHighlight(
                currentTheme, 'hilite', fgBg='bg'),
            'insertbackground': idleConf.GetHighlight(
                currentTheme, 'cursor', fgBg='fg'),
            'width': idleConf.GetOption('main', 'EditorWindow', 'width'),
            'height': idleConf.GetOption('main', 'EditorWindow', 'height'),
        }
        fontWeight = 'normal'
        if idleConf.GetOption('main', 'EditorWindow', 'font-bold',
                              type='bool'):
            fontWeight = 'bold'
        textcf['font'] = (idleConf.GetOption('main', 'EditorWindow', 'font'),
                          idleConf.GetOption('main', 'EditorWindow',
                                             'font-size'),
                          fontWeight)
        # override defaults with any user-specified settings
        textcf.update(kwargs)
        ScrolledText.__init__(self, master, **textcf)
开发者ID:Zeffar,项目名称:Elobot,代码行数:35,代码来源:gui.py

示例7: main

def main():
    global text_in
    global sock


    window = tk.Tk()
    window.wm_title('Vessel XIV')

    text_out = ScrolledText(window, state='disabled', takefocus=0)
    #text_out.configure(state='disabled')
    text_out.pack()

    text_in = tk.Entry(window, takefocus=1)
    text_in.bind("<Return>", lambda e: evaluate_in(e, text_in, text_out))
    text_in.pack()


    HOST = 'arctem.com'
    #HOST = 'localhost'
    PORT = 50001
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((HOST, PORT))

    t = threading.Thread(target=socket_thread, args=(sock, text_out))
    t.start()

    window.mainloop()
开发者ID:Arctem,项目名称:game_jam_2015,代码行数:27,代码来源:client.py

示例8: LongTextbox

class LongTextbox(Textbox):

	def config(self, **kwargs):
		if 'height' in kwargs:
			self.sentry.config(height=kwargs['height'])
		if 'width' in kwargs:
			self.sentry.config(width=kwargs['width'])
		if 'text' in kwargs:	
			self.sentry.insert(END, kwargs['text'])
		if 'lang' in kwargs:
			self.lang = kwargs['lang']
			self.label.config(text=self.lang[self.text])
		
	def place(self, **kwargs):
		self.parent = kwargs['parent']
		self.row = kwargs['row']
		self.column = kwargs['column']

		self.label = Label(self.parent, text=self.lang[self.text])
		self.sentry = ScrolledText(self.parent, relief=SOLID)

		self.label.grid(row=self.row, column=self.column)
		self.sentry.grid(row=self.row, column=self.column+1, sticky=E)

	def getData(self):
		return self.sentry.get('1.0', END + '-1c')

	def setData(self, data):
		self.sentry.delete('1.0', END)
		self.config(text=data)
开发者ID:wasifzaman,项目名称:ryb_tms,代码行数:30,代码来源:multiline_textbox.py

示例9: MainUI

class MainUI(Frame):
    def __init__(self, master=None):
        Frame.__init__(self, master, width=600, height=480)
        self.data_directory = StringVar()
        self.data_directory.set("no data selected... please select directory of google_speech_data")
        self.directory_prompt = Label(self, textvariable = self.data_directory)
        self.directory_prompt.grid(row=0,column=0,sticky=W)
        self.select_dir = Button(self, text ="Change directory")
        self.select_dir.grid(row=0,column=1)
        self.select_dir.bind("<Button-1>",self.chdir)
        self.gru_label = Label(self, text = "GRU Size:")
        self.gru_label.grid(row=1,column=0,sticky=E)
        self.gru_entry = Entry(self)
        self.gru_entry.insert(0,"20")
        self.gru_entry.grid(row=1,column=1)
        self.words_label = Label(self,text = "Words to learns: (one line per word)")
        self.words_label.grid(row=2,column=0,sticky=W)
        self.words = ScrolledText(self)
        self.words.grid(row=3,column=0,columnspan=2)
        self.trainbtn = Button(self, text ="Train model")
        self.trainbtn.bind("<Button-1>",self.train)
        self.trainbtn.grid(row=4,column=1)
        self.pack(side=LEFT)
    def chdir(self, event):
        self.speech_data = filedialog.askdirectory()
        if self.speech_data:
            self.data_directory.set("Using speech data from: "+self.speech_data)
            os.chdir(self.speech_data)
    def train(self, event):
        filename = filedialog.asksaveasfilename(title = "Select file to checkpoint the model to",filetypes =(("uspeech model checkpoint","*.model"),))
        if filename:
            pass #TODO Implement training routine
开发者ID:arjo129,项目名称:uSpeech,代码行数:32,代码来源:ui.py

示例10: __init__

    def __init__(self, master=None, **kwargs):
        """
        Constructor.

        Get default settings from user's IDLE configuration.
        """
        currentTheme = idleConf.CurrentTheme()
        textcf = dict(padx=5, wrap='word', undo='True',
                      foreground=idleConf.GetHighlight(currentTheme,
                                                       'normal', fgBg='fg'),
                      background=idleConf.GetHighlight(currentTheme,
                                                       'normal', fgBg='bg'),
                      highlightcolor=idleConf.GetHighlight(currentTheme,
                                                           'hilite', fgBg='fg'),
                      highlightbackground=idleConf.GetHighlight(currentTheme,
                                                                'hilite',
                                                                fgBg='bg'),
                      insertbackground=idleConf.GetHighlight(currentTheme,
                                                             'cursor',
                                                             fgBg='fg'),
                      width=idleConf.GetOption('main', 'EditorWindow', 'width'),
                      height=idleConf.GetOption('main', 'EditorWindow',
                                                'height')
                      )
        fontWeight = 'normal'
        if idleConf.GetOption('main', 'EditorWindow', 'font-bold', type='bool'):
            fontWeight = 'bold'
        textcf['font'] = (idleConf.GetOption('main', 'EditorWindow', 'font'),
                          idleConf.GetOption('main', 'EditorWindow',
                                             'font-size'),
                          fontWeight)
        # override defaults with any user-specified settings
        textcf.update(kwargs)
        ScrolledText.__init__(self, master, **textcf)
开发者ID:Darkdadaah,项目名称:pywikibot-core,代码行数:34,代码来源:gui.py

示例11: __init__

class ReadMailWindow:
    def __init__(self, receiver='[email protected]', sender='[email protected]', topic='DefaultTopic', text='Dear:\n\nDefaultLine\nDefaultLine2\nDefaultLine3\n\nSincerely,\nDefaultUser'):
        '''
        create the ReadMailWindow.
        '''
        self.root = tk.Tk()
        self.root.title('Mail from '+sender)
        self.root.geometry('300x200')
        
        self.receiver=receiver
        self.sender=sender
        self.topic=topic
        self.text=text
        
        self.pane_for_sender = tk.PanedWindow(self.root,orient=tk.HORIZONTAL, borderwidth=5)
        self.pane_for_sender.pack(fill=tk.BOTH)
        self.lable_for_sender = tk.Label(self.pane_for_sender, text='From:', width=5, justify=tk.LEFT, anchor=tk.W)
        self.entry_for_sender = tk.Entry(self.pane_for_sender, width=10)
        self.entry_for_sender.insert(0, self.sender)
        self.entry_for_sender.config(state=tk.DISABLED)
        self.pane_for_sender.add(self.lable_for_sender)
        self.pane_for_sender.add(self.entry_for_sender)
        
        self.pane_for_topic = tk.PanedWindow(self.root, orient=tk.HORIZONTAL, borderwidth=5)
        self.pane_for_topic.pack(fill=tk.BOTH)
        self.lable_for_topic = tk.Label(self.pane_for_topic, text='Topic:', width=5, justify=tk.LEFT, anchor=tk.W)
        self.entry_for_topic = tk.Entry(self.pane_for_topic, width=10)
        self.entry_for_topic.insert(0, self.topic)
        self.entry_for_topic.config(state=tk.DISABLED)
        self.pane_for_topic.add(self.lable_for_topic)
        self.pane_for_topic.add(self.entry_for_topic)
        
        self.pane_for_content = tk.PanedWindow(self.root, orient=HORIZONTAL, borderwidth=7)
        self.pane_for_content.pack(fill=tk.BOTH, expand=1)
        self.lable_for_content = tk.Label(self.pane_for_content, text='Text:', justify=tk.LEFT, anchor=tk.W)
        self.text_for_content = ScrolledText(self.pane_for_content, width=10, height=4)
        self.text_for_content.insert(1.0, self.text)
        self.text_for_content.config(state=tk.DISABLED)
        self.pane_for_content.add(self.lable_for_content)
        self.pane_for_content.add(self.text_for_content)
        
        self.pane_for_button = tk.PanedWindow(self.root, orient=tk.HORIZONTAL)
        self.pane_for_button.pack(fill=tk.BOTH)
        self.button_for_reply = tk.Button(self.pane_for_button, text="Reply", command=self.Reply)
        self.button_for_close = tk.Button(self.pane_for_button, text="Exit", command=self.Destroy, width=5)
        self.pane_for_button.add(self.button_for_close) 
        self.pane_for_button.add(self.button_for_reply)
        

    def Reply(self):
        with open('acpwd.txt') as file:
            for line in file:
                acpwd = line.split(':')
                self.SMW = smw.SendMailWindow(self.receiver, self.sender, acpwd[1])
        self.SMW.text_for_content.insert(1.0, '\n\n---------------\n'+self.text)
        #self.root.destroy()
    
    def Destroy(self):
        self.root.destroy() 
开发者ID:misterlihao,项目名称:network-programming-project,代码行数:59,代码来源:ReadMailWindow.py

示例12: LongTextbox

class LongTextbox(Textbox):

	def config(self, **kwargs):

		try:
			self.sentry.config(height=kwargs['height'])
		except:
			pass
			#print("the widget could not be configured")

		try:
			self.sentry.config(width=kwargs['width'])
		except:
			pass
			#print("the widget could not be configured")

		try:
			#self.text = kwargs['text']
			#self.sentry.delete(1.0, END)
			self.sentry.insert(END, kwargs['text'])
		except:
			pass
			#print("the widget could not be configured")
			
		try:
			self.lang = kwargs['lang']
			self.label.config(text=self.lang[self.text])
		except:
			pass


	def trytoplace(self, **kwargs):
		self.parent = kwargs['parent']
		self.row = kwargs['row']
		self.column = kwargs['column']


	def place(self, **kwargs):

		try:
			self.trytoplace(**kwargs)
		except:
			pass
			#print("widget could not be placed")

		self.label = Label(self.parent, text=self.lang[self.text])
		self.sentry = ScrolledText(self.parent, relief=SOLID)

		self.label.grid(row=self.row, column=self.column)
		self.sentry.grid(row=self.row, column=self.column+1, sticky=E)


	def getData(self):
		return self.sentry.get('1.0', END + '-1c')


	def setData(self, data):
		self.sentry.delete('1.0', END)
		self.config(text=data)
开发者ID:drinkingTea,项目名称:ryb_sms,代码行数:59,代码来源:labelWidgets2.py

示例13: TextFrame

class TextFrame(ttk.LabelFrame):

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self._init_ui()

    def _init_ui(self):
        self.textbox = ScrolledText(self, width=70, height=10)
        self.textbox.bind("<1>", lambda event: self.textbox.focus_set())
        self.textbox.pack(expand=True, fill='both')
开发者ID:cachitas,项目名称:meeplan,代码行数:10,代码来源:converter.py

示例14: __init__

    def __init__(self, master=None, **cnf):
        # Initialize base class
        ScrolledText.__init__(self, master, **cnf)

        # Define tags for formatting styles
        self.tag_config("X", underline=1)
        self.tag_config("!", font=BOLDFONT)
        self.tag_config("_", font=ITALICFONT)

        # Set state to idle
        self.fp = None
        self.lineno = 0
开发者ID:jcsalterego,项目名称:py3k-atsign,代码行数:12,代码来源:ManPage.py

示例15: __init__

    def __init__(self, master):
        self.master = master
        master.title("Client")
        master.geometry("600x750")

        self.chat = ScrolledText(self.master, state = "disabled", width = 72)
        self.chat.grid(padx = 4, pady = 4, columnspan = 2)

        self.chat_entry = ScrolledText(self.master, width = 55, height = 3)
        self.chat_entry.grid(row = 1, padx = 4, pady = 4)

        self.send_button = Button(self.master, text = "Send", width = 10, height = 2)
        self.send_button.grid(row = 1, column = 1, padx = 4, pady = 4)
开发者ID:rzzzwilson,项目名称:Random-Stuff,代码行数:13,代码来源:test.py


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