コード例 #1
0
ファイル: GUI.py プロジェクト: FCUIECSHomework/Contact_Python
    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)
コード例 #2
0
ファイル: gui.py プロジェクト: Nivgov/AvodatGemer
    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)
コード例 #3
0
ファイル: recipe-578076.py プロジェクト: jacob-carrier/code
 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)
コード例 #4
0
 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
コード例 #5
0
    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
コード例 #6
0
ファイル: gui.py プロジェクト: Zeffar/Elobot
    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)
コード例 #7
0
ファイル: client.py プロジェクト: Arctem/game_jam_2015
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()
コード例 #8
0
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)
コード例 #9
0
ファイル: ui.py プロジェクト: arjo129/uSpeech
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
コード例 #10
0
ファイル: gui.py プロジェクト: Darkdadaah/pywikibot-core
    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)
コード例 #11
0
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() 
コード例 #12
0
ファイル: labelWidgets2.py プロジェクト: drinkingTea/ryb_sms
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)
コード例 #13
0
ファイル: converter.py プロジェクト: cachitas/meeplan
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')
コード例 #14
0
ファイル: ManPage.py プロジェクト: jcsalterego/py3k-atsign
    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
コード例 #15
0
ファイル: test.py プロジェクト: rzzzwilson/Random-Stuff
    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)
コード例 #16
0
ファイル: GUI-SSH.py プロジェクト: N-NicK/GUI-SSH
def Login(entries,root):
    text=[]
    for entry in entries:
        text.append(entry[1].get())
    print(text)
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    ssh.connect(text[0], username=text[1], password=text[2])
    stdin, stdout, stderr = ssh.exec_command(text[3])
    u=stdout.readlines()
    output = ''.join(u)
    sc=ScrolledText(root)
    sc.pack(side=LEFT)
    sc.insert(END, output)
コード例 #17
0
    def _init_repl_frame(self, notebook):
        frame = ttk.Frame(notebook)

        self.repl_input = ScrolledText(frame, height=15, width=80)
        self.repl_input.insert(tk.END,
                '-- REPL command input\n'
                '-- Press Ctrl-Enter to run command\n'
                'client_by_name(\'OP\'):extra().superuser = true')
        self.repl_input.bind('<Control-Return>', self._repl_send)
        self.repl_input.pack()
        self.repl_output = ScrolledText(frame, height=5, width=80)
        self.repl_output.pack()

        return frame
コード例 #18
0
ファイル: gui.py プロジェクト: wearyoung/daovision
	def _conButtonCmd(self):
		popwin = PopupWindow("Container Log")
		popwin.grab_set()
		popwin.focus()
		details = self.checkresult.getContainerLogs()
		stext = ScrolledText(popwin)
		stext.config(font = ("courier", 15, "normal"))
		stext.pack()
		for d in details:
			stext.insert("end",d)
		stext.see("end")
コード例 #19
0
ファイル: core.py プロジェクト: Nazek42/pypad
    def __init__(self, file=None, text="", parent=None, **kw):
        if parent is None:
            self.parent = editor
        else:
            self.parent = parent
        ScrolledText.__init__(self, parent, **kw)

        if file is None:
            self.is_untitled = True
            self._file = tempfile.NamedTemporaryFile(mode="w+t", prefix=UNTITLED)
        else:
            self.is_untitled = False
            self._file = file

        self.text = text
コード例 #20
0
ファイル: mp.py プロジェクト: kartiknagpal/sandbox
class View(Frame):
    def __init__ (self,parent=None):
        Frame.__init__(self,parent)
        self.pack()
        self.makeWidgets()
        self.scrolltext = ScrolledText(master=self)
        self.scrolltext.pack()

    def makeWidgets(self):
        btn = Button(text='Hello World',command=self.onClick)
        btn.pack(side=TOP)

    def onClick(self):
        '''Delegate event handling to Controller'''
        app.controller.handleClick()
コード例 #21
0
ファイル: hostmod.py プロジェクト: gliheng/Blackhole
    def createTab(self, text, content):
        ind = self.tabIndMax
        tab = Radiobutton(self.tabs_panel, text=text,
                font=NORMAL_FONT, indicatoron=NO,
                variable=self.tabInd, value=ind,
                command=lambda:self.switchTab(ind))
        self.tabIndMax += 1
        tab.pack(side=TOP, fill=X)

        txtCtrl = ScrolledText(self.txt_panel, undo = True)
        txtCtrl.insert(1.0, content)

        self.tabs.append(tab)
        self.txtCtrls.append(txtCtrl)
        return ind
コード例 #22
0
 def __init__(self, master=None, cnf={}, **kw):
     super(GuiConsole, self).__init__(master, cnf, **kw)
     self.pack(fill=BOTH, expand=YES)
     self.console = ScrolledText(self, font=('Source Code Pro', 12, 'normal'))
     self.console.pack(side=TOP, fill=BOTH, expand=YES, padx=5, pady=5)
     self.console.focus()
     self.console.mark_set(INSERT, '1.0')
コード例 #23
0
ファイル: auto_mailer.py プロジェクト: pokk/Mailer
    def __init__(self, master=None):
        # Avoiding to send it continuously.
        self.lock = False

        Frame.__init__(self, master)
        self.grid()
        self.master = master
        # Setting for ComboBox.
        self.url_lang_combobox_str = StringVar()
        self.url_lang_combobox_list = lang_list
        # UI components.
        self.receiver_email_text = Label(self, text="Receiver:")
        self.receiver_email_field = Entry(self, width=50)
        self.subject_text = Label(self, text='Subject:')
        self.subject_field = Entry(self, width=50)
        self.receiver_name_text = Label(self, text='Name:')
        self.receiver_name_field = Entry(self, width=50)
        self.url_lang_text = Label(self, text='Link lang:')
        self.url_lang_combobox = Combobox(self, textvariable=self.url_lang_combobox_str, values=self.url_lang_combobox_list, state='readonly')
        self.send_progressbar = Progressbar(self, orient='horizontal', length=500, mode='determinate', maximum=300)
        self.send_button = Button(self, text='Send', command=self._send_mail)
        self.quit_button = Button(self, text='Exit', command=self.__exit)
        self.log_msg_text = ScrolledText(self)
        # Attachment.
        self.mail_attachment_list = attachment_list[:]
        self.url_lang_link_title = None
        self.url_lang_link = copy.deepcopy(content_link)
        # Mailer
        self._mailer = None

        # Let Mailer can control components.
        Mailer.window_content = self

        self.__create_widgets()
コード例 #24
0
 def __init__(self, reps=3):
     self.reps = reps # uses default Tk root
     self.text = ScrolledText() # save widget as state
     self.text.pack()
     threadChecker(self.text) # start thread check loop
     self.text.bind('<Button-1>', # 3.x need list for map, range ok
                    lambda event: list(map(self.onEvent, range(6))) )
コード例 #25
0
ファイル: GUI.py プロジェクト: samhowes/Downloader
	def onStart(self): 
		self.stdout = GUITools.TSafeRedirect()						# Create a buffer to replace stdout
		self.systemStreams = (sys.stdin, sys.stdout, sys.stderr)	# Save the system streams to replace them later
		sys.stdout = self.stdout									# Redirect writes to stdout and stderr
		sys.stderr = self.stdout
		
		newFrame = Frame(self)										# Create a display for the stdout
		self.textDisplay = ScrolledText(newFrame)
		self.textDisplay.config(state=DISABLED)						# make it read only
	
		self.container.pack_forget()								# remove the old window contents
		del self.container											# explicitly delete to destroy the elements
		
		self.mainContainer = newFrame									# Replace the windows content	
		self.progressContainer = Frame(self)
		self.progressContainer.pack(side=BOTTOM, fill=X)
		self.mainContainer.pack(expand=YES, fill=BOTH)					# Pack now to display the frame
		self.textDisplay.pack(expand=YES, fill=BOTH)
		
		self.callbackQ = Queue()									# Kick off the main worker thread to start downloading
		self.mainWorker = DownloadMaster(self, self.callbackQ, name='DownloadMaster')		
		#self.mainWorker = DryRun(self, self.callbackQ, name='DryRun')		
		self.mainWorker.start()
		
		self.after(self.WAKE_INTERVAL, self.onWake)					# Set the timer to refresh the GUI
コード例 #26
0
ファイル: im.py プロジェクト: mordervomubel/im
	def __init__(self, peer):
		Toplevel.__init__(self, mainwindow)
		self.peer = peer
		self.recvFile = None

		self.title(peer[0] + ':' + str(peer[1]))

		#self.root = Tk()
		#self.main = Frame(self.root)
		self.main = Frame(self)
		self.main.pack(expand=True, fill=BOTH)

		self.chat_Text = ScrolledText(self.main)
		self.chat_Text.pack(expand=True, fill=BOTH)
		self.chat_Text['height'] = 10
		#print self.keys()
		#print self.chat_Text.keys()

		self.send_Frame = Frame(self.main)
		self.send_Frame.pack(fill=X)

		self.send_Text = Entry(self.send_Frame)
		self.send_Text.pack(side=LEFT, expand=True, fill=X)
		self.send_Text.bind('<Return>', self.send_Action)
		self.send_Button = Button(self.send_Frame, text='Send', command=self.send_Action)
		self.send_Button.pack(side=LEFT)
		self.holePunch_Button = Button(self.send_Frame, text='UDP punch', command=self.holePunch_Action)
		self.holePunch_Button.pack(side=LEFT)
		self.sendFile_Button = Button(self.send_Frame, text='File', command=self.sendFile_Action)
		self.sendFile_Button.pack(side=LEFT)

		self.status_Label = Label(self.main, text='Peer: ' + self.peer[0] + ':' + str(self.peer[1]))
		self.status_Label.pack()

		self.send_Text.focus()
コード例 #27
0
ファイル: gui.py プロジェクト: wearyoung/daovision
	def __init__(self, parent):
		Frame.__init__(self, parent)
		self.scrolltext = ScrolledText(self, width = 120,
				font = ("", 14, "normal"), height = 30)
		self.scrolltext.config(state = "disable")

		f = Frame(self)
		self.entry = Entry(f, width = 75, font = ("", 15, "normal"))
#		self.entry.grab_set()
		self.entry.focus_set()
		self.entry.grid(row = 0, column = 0)
		self.entry.bind("<Return>", lambda event, frame = self: frame._runCommand())

		self.button1 = Button(f, text = "sumbmit", font = ("", 15, "normal"),
						command = lambda frame = self: frame._runCommand())
		self.button1.grid(row = 0, column = 1, padx = 4, pady = 2)
		self.button2 = Button(f, text = "clear", font = ("", 15, "normal"),
						command = lambda frame = self: frame._deleteText())
		self.button2.grid(row = 0, column = 2, padx = 4, pady = 2)
		f.grid(row = 1, column = 0)
		self.scrolltext.grid(row = 0, column = 0)

		with shelve.open("userconfigdb") as db:
			keys = tuple(db.keys())
		if not keys:
			configButtonCmd()
		with shelve.open("userconfigdb") as db:
			self.sshIP = db[tuple(db.keys())[0]].hostaddress
		self._configButtonCmd()
コード例 #28
0
    def __init__(self, parent, *args, **kwargs):
        tk.Frame.__init__(self, parent, *args, **kwargs)

        self.parent = parent
        self.parent.option_add('*tearOff', False)
        self.after(50, self.onAfter)

        #set this frame to expand to %100 available space
        self.columnconfigure(0, weight=1)
        self.rowconfigure(0, weight=1)

        #init menu
        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)

        fileMenu = Menu(menubar)
        fileMenu.add_command(label="Save", command=self.onSave)
        fileMenu.add_command(label="Load", command=self.onLoad)
        fileMenu.add_command(label="Exit", command=self.onExit)
        menubar.add_cascade(label="File", menu=fileMenu)

        #init textbox
        self.text = ScrolledText(self, wrap='word')

        #add widgets to the layout manager
        self.text.grid(sticky=inflate)
コード例 #29
0
 def __init__(self, reps=3):
     self.reps = reps
     self.text = ScrolledText()
     self.text.pack()
     threadChecker(self.text)
     self.text.bind('<Button-1>',
                    lambda event: list(map(self.onEvent, range(6))))
コード例 #30
0
ファイル: manpage.py プロジェクト: henrywoo/Python3.1.3-Linux
    def __init__(self, master=None, **cnf):
        ScrolledText.__init__(self, master, **cnf)

        bold = Font(font=self['font']).copy()
        bold.config(weight='bold')
        italic = Font(font=self['font']).copy()
        italic.config(slant='italic')

        # Define tags for formatting styles
        self.tag_config('X', underline=1)
        self.tag_config('!', font=bold)
        self.tag_config('_', font=italic)

        # Set state to idle
        self.fp = None
        self.lineno = 0