Exemple #1
0
    def __init__(self,central,name,bodyTopNode,specTopNode):
        self.dirty = False
        self.central = central
        self.name = name
        self.toplevel = Toplevel()
        self.toplevel.title(name)
        self.pw = Pmw.PanedWidget(self.toplevel, orient='vertical')

        specpane = self.pw.add("spec")
        bodypane = self.pw.add("body")
        self.specText = ScrolledText(specpane,font=("monaco",10),height=5,background=Colors.background)
        self.specText.pack(expand=YES,fill=BOTH)
        self.bodyText = ScrolledText(bodypane,font=("monaco",10),height=15,background=Colors.background)
        self.bodyText.pack(expand=YES,fill=BOTH)        
        self.nodeMap = {bodyTopNode: self.bodyText, specTopNode: self.specText}
        self.textMap = {self.bodyText: bodyTopNode, self.specText: specTopNode}
        Widget.bind(self.bodyText,'<Any-KeyPress>',self.setDirty)
        Widget.bind(self.specText,'<Any-KeyPress>',self.setDirty)
        self.popup = Menu(self.toplevel,tearoff=0)
        self.popup.add_command(label="Dismiss", command=self.nothing)
        self.popup.add_command(label="Diagram", command=self.goDiagram)
        self.popup.add_command(label="Abort", command=self.abort)
        self.popup.add_command(label="Accept", command=self.accept)
        self.popup.add_command(label="Recolor", command=self.recolor)        
        def popupMenu(event):
            self.popup.post(event.x_root,event.y_root)
        self.toplevel.bind('<Button-3>', popupMenu)
        self.pw.pack(expand=YES,fill=BOTH)
        self.toplevel.protocol("WM_DELETE_WINDOW",self.central.doQuit)
        self.refresh()
 def __init__(self, root, api, search_handler):
     Frame.__init__(self, root)
     if not search_handler or not api:
         raise PixivError(
             'You must set  authPixivApi and search_handler for the DownloadFrame'
         )
     self.api = api
     self.search_handler = search_handler
     self.downloader = IllustrationDownloader(api)
     self.queue = PixivQueue(self.downloader,
                             callback=self.download_callback)
     self.task_text = ScrolledText(self,
                                   height=20,
                                   width=30,
                                   bg='light gray')
     self.print_text = ScrolledText(self,
                                    height=20,
                                    width=40,
                                    bg='light gray')
     self.root = root
     self.frames = [
         DownloadFrame(self, 'By Url or Id', self.queue, self.api,
                       self.task_text),
         SearchFrame(self, 'By Search', self.queue, self.api,
                     self.search_handler),
         RankingFrame(self, 'By Ranking', self.queue, self.api),
         RelatedFrame(self, 'By Related', self.queue, self.api)
     ]
     self.switch_menu = None
     self.init_ui()
Exemple #3
0
    def __init__(self, master=None):
        """Elemente der Form kreieren"""
        Frame.__init__(self, master)
        self.pack()
        #self.createWidgets()
        self.text_label = Label(self,
            height=1, width=80, anchor=NW, text="Play-Out-Logging Nr: ")
        self.text_label.pack()

        self.text_label_1 = Label(self,
            height=1, width=80, text="Titel aktuell")
        self.text_label_1.pack()

        self.textBox = ScrolledText(self, height=5, width=80)
        self.textBox.pack()
        self.textBox.insert(END, "In the Beginning...\n")

        self.text_label_2 = Label(self,
            height=1, width=80, text="Rueckmeldung von Webserver")
        self.text_label_2.pack()

        self.textBox1 = ScrolledText(self, height=10, width=80)
        self.textBox1.pack()
        self.textBox1.insert(END, "...and the End\n")

        # registering callback
        self.listenID = self.after(500, self.lets_rock)
 def __init__(self, parent, title, msg):
     self.title = title
     self.msg = msg
     self.frame = Frame(parent, {'relief': 'raised', 'bd': 2})
     self.frame.packing = {'expand': 0, 'fill': 'both'}
     self.button = Checkbutton(self.frame,
                          {'text': title,
                           'command': self.toggle})
     self.button.pack({'anchor': 'w'})
     headertext = msg.getheadertext(
             lambda x: x != 'received' and x[:5] != 'x400-')
     height = countlines(headertext, 4)
     if height:
         self.htext = ScrolledText(self.frame,
                           {'height': height,
                            'width': 80,
                            'wrap': 'none',
                            'relief': 'raised',
                            'bd': 2})
         self.htext.packing = {'expand': 1, 'fill': 'both',
                               'after': self.button}
         self.htext.insert('end', headertext)
     else:
         self.htext = Frame(self.frame,
                            {'relief': 'raised', 'bd': 2})
         self.htext.packing = {'side': 'top',
                               'ipady': 2,
                               'fill': 'x',
                               'after': self.button}
     body = msg.getbody()
     if type(body) == StringType:
         self.pad = None
         height = countlines(body, 10)
         if height:
             self.btext = ScrolledText(self.frame,
                               {'height': height,
                                'width': 80,
                                'wrap': 'none',
                                'relief': 'raised',
                                'bd': 2})
             self.btext.packing = {'expand': 1,
                                   'fill': 'both'}
             self.btext.insert('end', body)
         else:
             self.btext = None
         self.parts = None
     else:
         self.pad = Frame(self.frame,
                          {'relief': 'flat', 'bd': 2})
         self.pad.packing = {'side': 'left', 'ipadx': 10,
                             'fill': 'y', 'after': self.htext}
         self.parts = []
         for i in range(len(body)):
             p = MimeViewer(self.frame,
                            '%s.%d' % (title, i+1),
                            body[i])
             self.parts.append(p)
         self.btext = None
     self.collapsed = 1
Exemple #5
0
    def configure_GUI(self):
        # main window
        bg_color = '#208090'
        self['bg'] = bg_color
        self.geometry("400x500+520+500")
        self.resizable(width=True, height=True)

        self.frm_top = Frame(self, width=380, height=250)
        self.frm_mid = Frame(self, width=380, height=150)
        self.frm_btm = Frame(self, width=380, height=30)
        self.frm_btm['bg'] = bg_color

        self.label_msg_list = Label(self, justify=LEFT, text=u"""消息列表""")
        self.label_user_name = Label(self, justify=LEFT, text=self.__user_name)

        self.text_msg_List = ScrolledText(self.frm_top,
                                          borderwidth=1,
                                          highlightthickness=0,
                                          relief='flat',
                                          bg='#fffff0')
        self.text_msg_List.tag_config('userColor', foreground='red')
        self.text_msg_List.place(x=0, y=0, width=380, height=250)

        self.text_client_msg = ScrolledText(self.frm_mid)
        self.text_client_msg.grid(row=0, column=0)

        self.button_send_msg = Button(self.frm_btm,
                                      text='发送消息',
                                      command=self.__send_msg_btn_cmd)
        self.button_send_msg.place(x=0, y=0, width=100, height=30)

        self.button_exit_room = Button(self.frm_btm,
                                       text='退出房间',
                                       command=self.__exit_room_btn_cmd)
        self.button_exit_room.place(x=280, y=0, width=100, height=30)

        self.label_msg_list.grid(row=0, column=0, padx=2, pady=2, sticky=W)
        self.frm_top.grid(row=1, column=0, padx=2, pady=2)
        self.label_user_name.grid(row=2, column=0, padx=2, pady=2, sticky=W)
        self.frm_mid.grid(
            row=3,
            column=0,
            padx=2,
            pady=2,
        )
        self.frm_btm.grid(
            row=4,
            column=0,
            padx=2,
            pady=2,
        )

        self.frm_top.grid_propagate(0)
        self.frm_mid.grid_propagate(0)
        self.frm_btm.grid_propagate(0)
Exemple #6
0
  def __init__(self,master,clisock= socket(AF_INET, SOCK_DGRAM),account="20161001234"):
    self.Account=account
    self.Line="."
    
    Tkinter.Frame.__init__(self, master, padx=10, pady=10)   
    master.title("Talking With"+self.Account)
    #创建几个frame作为容器
    self.frame_left_top   = Frame(master,width=380, height=270, bg='white')
    self.frame_left_center  = Frame(master,width=380, height=100, bg='white')
    self.frame_left_bottom  = Frame(master,width=380, height=20)
    self.frame_left_bottom1 = Frame(master,width=380, height=20)
    self.frame_right     = Frame(master,width=170, height=400, bg='white')

    self.frame_Account = Frame(master,width=380, height=20)
    self.frame_AccountName=Frame(master,width=100, height=20, bg='white')
    ##创建需要的几个元素
    self.text_msglist    = ScrolledText(self.frame_left_top,width=60, height=22)
    self.text_msg      = ScrolledText(self.frame_left_center,width=60, height=8);
    self.button_sendmsg   = Button(self.frame_left_bottom, text=unicode('发送','eucgb2312_cn'), command=self.sendmessage)   
    self.button_recvmsg   = Button(self.frame_left_bottom1, text=unicode('接收','eucgb2312_cn'), command=self.recvessage)
    
    self.button_Account   = Button(self.frame_Account, text=unicode('设置用户:','eucgb2312_cn'), command=self.SetNewAccount)
    self.text_accountname    = Text(self.frame_AccountName,)
    #UDP
    self.ADDR = ('202.114.196.97', 21568)
    self.udpCliSock = clisock
    #创建一个绿色的tag
    self.text_msglist.tag_config('green', foreground='#008B00')
    #使用grid设置各个容器位置
    self.frame_left_top.grid(row=0, column=0, padx=2, pady=5)
    self.frame_left_center.grid(row=1, column=0, padx=2, pady=5)
    self.frame_left_bottom.grid(row=2, column=0)
    self.frame_left_bottom1.grid(row=2, column=0)
    self.frame_right.grid(row=0, column=1, rowspan=3, padx=4, pady=5)

    self.frame_Account.grid(row=5, column=0, padx=0, pady=20)
    self.frame_AccountName.grid(row=5, column=0,padx=0, pady=20)   
    self.frame_left_top.grid_propagate(0)
    self.frame_left_center.grid_propagate(0)
    self.frame_left_bottom.grid_propagate(0)
    self.frame_Account.grid_propagate(0)
    self.frame_AccountName.grid_propagate(0)    
    #把元素填充进frame
    self.text_msglist.pack()
    self.text_msg.pack()
    self.button_sendmsg.grid(sticky=E)
    self.button_recvmsg.grid(sticky=E)

    self.button_Account.grid(sticky=E)
    self.text_accountname.grid()
    

    t=threading.Thread(target=self.OnlineRecvMessage)
    t.start()
def Design_Tab():

    textExecutionInput = Label(tab,text="English Text",font=("Arial", 10, "bold"))
    textExecutionInput.place(x=((FIRST_COL_Y+(0*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(0*ROW_INC))/REF_ROW_COUNT)*b)

    textExecutionOutput = Label(tab,text="Unicode",font=("Arial", 10, "bold"))
    textExecutionOutput.place(x=((FIRST_COL_Y+(2.75*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(0*ROW_INC))/REF_ROW_COUNT)*b)

    buttonHelp = Button(tab, text='Unicode Help', width="15",command=lambda: ShowUnicodeHelp(ChosenLanguage.get(), textOutputSection))
    buttonHelp.place(x=((FIRST_COL_Y+(1*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(0*ROW_INC))/REF_ROW_COUNT)*b)
    
    ChosenLanguage = IntVar()

    rbTamil = Radiobutton(tab, text="Tamil",  variable=ChosenLanguage, value=TAMIL_FLAG,)
                          #command=lambda: ChangeTab(TAMIL_FLAG))
    rbTamil.place(x=((FIRST_COL_Y+(1.5*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(0*ROW_INC))/REF_ROW_COUNT)*b)

    rbMalayalam = Radiobutton(tab, text="Malayalam", variable=ChosenLanguage, value=MALAYALAM_FLAG,)
                            #command=lambda: ChangeTab(MALAYALAM_FLAG))
    rbMalayalam.place(x=((FIRST_COL_Y+(2.0*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(0*ROW_INC))/REF_ROW_COUNT)*b)

    ChosenLanguage.set(-1)

    buttonSaveCodeasKal = Button(tab, text='Save English text as .txt file', width="25",command=lambda: SaveInputasText(textCommandSection))
    buttonSaveCodeasKal.place(x=((FIRST_COL_Y+(0*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(1*ROW_INC))/REF_ROW_COUNT)*b)

    buttonConvertToUnicode = Button(tab, text='Convert Code to Unicode', width="25",command=lambda: ConvertToUnicode(textCommandSection,
                                                                                                                     ChosenLanguage.get(), textOutputSection ))
    buttonConvertToUnicode.place(x=((FIRST_COL_Y+(1*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(1*ROW_INC))/REF_ROW_COUNT)*b)
    
    buttonClear = Button(tab, text='Clear', width="6",command=lambda: ClearCommands(textCommandSection, textOutputSection))
    buttonClear.place(x=((FIRST_COL_Y+(2*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(1*ROW_INC))/REF_ROW_COUNT)*b)

    buttonOutputasTxt = Button(tab, text='Save Unicode text as .txt file', width="25",command=lambda: SaveOutputasText(textOutputSection))
    buttonOutputasTxt.place(x=((FIRST_COL_Y+(2.75*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(1*ROW_INC))/REF_ROW_COUNT)*b)

    
    textCommandSection = ScrolledText(tab, undo=True, width=a/21, height=b/30)
    textCommandSection['font'] = ('consolas', '12')
    textCommandSection.place(x=((FIRST_COL_Y+(0*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(2*ROW_INC))/REF_ROW_COUNT)*b)

    textOutputSection = ScrolledText(tab, undo=True, width=a/21, height=b/30)
    textOutputSection['font'] = ('consolas', '12')
    textOutputSection.place(x=((FIRST_COL_Y+(2.75*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(2*ROW_INC))/REF_ROW_COUNT)*b)

    buttonAbout = Button(tab, text='About', width="10",command=lambda: messageShow('Info', '*****@*****.**'))
    buttonAbout.place(x=((FIRST_COL_Y+(0*COL_INC))/REF_COL_COUNT)*a,y=((FIRST_COL_X+(16*ROW_INC))/REF_ROW_COUNT)*b)

    textCommandSection.focus()
    
    return None
Exemple #8
0
 def body(self, master):
     self.resizable(0, 0)
     self.catIconImage = Tk.PhotoImage(file=GIFFILE)  # statt file=
     self.catIcon = Tk.Label(master, image=self.catIconImage)
     self.catIcon.pack(side=Tk.TOP)
     label = Tk.Label(master, text=crnotice1)
     label.pack(side=Tk.TOP)
     font = "Helvetica " + TITLEFONTSIZE
     label = Tk.Label(master, font=font, text=crnotice2, justify=Tk.CENTER)
     label.pack(side=Tk.TOP)
     color = 'green'
     font = "Helvetica " + AXISFONTSIZE
     self.infoText = ScrolledText(
         master,
         relief=Tk.FLAT,
         padx=3,
         pady=3,
         background=color,
         #foreground="black",
         wrap='word',
         width=60,
         height=12,
         font=font)
     self.infoText.pack(expand=0, fill=X, side=Tk.BOTTOM)
     self.infoText.delete('0.0', Tk.END)
     self.infoText.insert('0.0', getLicense())
     self.infoText.configure(state=Tk.DISABLED)
     self.title("STARS - About")
Exemple #9
0
  def __init__(self, master, sendfunc):
    """
    Initializes the autotyper.
    
    @param master: the main tk window
    @type  master: Tk

    @param sendfunc: the callback function
    @type  sendfunc: function
    """
    self._sendfunc = sendfunc
    
    self._frame = Toplevel(master)
    
    # self._frame.geometry("400x300")
    self._frame.title("Lyntin -- Autotyper")
    
    self._frame.protocol("WM_DELETE_WINDOW", self.cancel)
    
    if os.name == "posix":
      fontname = "Courier"
    else:
      fontname = "Fixedsys"
    fnt = tkFont.Font(family=fontname, size=12)
    
    self._txt = ScrolledText(self._frame, fg="white", bg="black", 
                             font=fnt, height=20)
    self._txt.pack(side=TOP, fill=BOTH, expand=1)
    
    self._send_btn = Button(self._frame, text="Send", command=self.send)
    self._send_btn.pack(side=LEFT, fill=X, expand=0)
    
    self._cancel_btn = Button(self._frame, text="Cancel", command=self.cancel)
    self._cancel_btn.pack(side=RIGHT, fill=X, expand=0)
Exemple #10
0
 def history(self):
     from ScrolledText import ScrolledText
     win = ScrolledText(Toplevel(), width=100)
     history = self.guicommander.gethistory()
     win.insert(END, history)
     win.pack(expand=1, fill=BOTH)
     win.focus_set()
Exemple #11
0
    def editor(self):
        """ combine some Widgets to an enhanced editor (incl. Scrollbar)

        --> self.text
                the text widget itself

        --> self.opened_file_label
                Label on top of the editfield to show the name of the current
                opened File
                It can be used to show textchanges
        """
        # build widgets
        self.txtfrm = tk.Frame(self)
        self.txtfrm.pack(fill=tk.BOTH, side=tk.LEFT, expand=tk.YES)
        self.opened_file_label = tk.Label(self.txtfrm, text="No File chosen")
        self.opened_file_label.pack(fill=tk.X)
        self.text = ScrolledText(self.txtfrm, bg="white",
                                undo=1, maxundo=30,
                                wrap=tk.WORD)
        self.text.pack(fill=tk.BOTH, expand=tk.YES, side=tk.LEFT)
        self.text.insert(1.0, u"Please open a File to edit")

        # build first(reference -- new name??) hash for comparison on changes
        self.hash_opened_filename = hash(self.text.get(1.0,tk.END))

        # Set focus on textwidget and move cursor to the upper left
        self.text.focus_set()
        self.text.mark_set(tk.INSERT, '0.0')      # goto line
        self.text.see(tk.INSERT)                  # scroll to line
Exemple #12
0
    def __init__(self, app):
        self.app = app
        self.enabled = True  # enabling or disabling logging

        # get package loggers
        self.loggers = []
        self.pkgName = __name__.split('.')[0]
        for name in logging.Logger.manager.loggerDict.keys():
            if self.pkgName in name:
                self.loggers.append(logging.getLogger(name))

        self.font = tkFont.Font(family='Courier New', size=12)
        # make text for normal logs
        self.logFrame = tk.Frame(self.app.root)
        self.logScroll = ScrolledText(self.app.root,
                                      bd=0,
                                      highlightthickness=0,
                                      font=self.font,
                                      bg=COL_PRIM,
                                      fg=COL_HL,
                                      width=80)
        self.logScroll.pack(side=tk.RIGHT, fill=tk.Y)

        # make warning panel
        self.alert = tk.Label(self.app.graphEditor.bg,
                              cursor='X_cursor',
                              font=self.font,
                              bg=COL_HL,
                              fg=COL_BG)
        self.alert.bind('<Button-1>', lambda _: self.resetWarning())
        self.alert.pack(side=tk.TOP)
        self.alert.pack_forget()  # initially not visible

        self.enableLog(False)  # initially, disable normal logs
	def FileTreeDoubleClick(self, event): 
		'''
		Event Listener for Double Click on a File Tree Item.  This method will display the hexdump of the clicked item in a new notebook tab. 
		'''
		item = self.fileTree.selection()[0]

		#check that clicked item is a file
		if os.path.isfile(item): 
			self.evtLogger.logEvent(self, "Open Hexview of file: "+item)

			#create new frame
			self.fileViewFrame = Frame(self.nb)
			self.fileViewFrame.grid(row=0, column=0, columnspan=2, sticky='new')

			#create scrolled text box to display hex dump
			self.fileViewText = ScrolledText(self.fileViewFrame, height=40)
			self.fileViewText.grid(row=0, column=0, sticky='nsew', pady=5, padx=5)

			#read in contents of selected item
			with open(item, 'rb') as f: 
				content = f.read() 
				text = u.hexdump(content)

				#display contents in new scrolled text box
				self.fileViewText.insert(END, text)
				self.fileViewText.config(state=DISABLED)

			#add Frame to notebook
			self.nb.add(self.fileViewFrame, text=self.fileTree.item(item, "text"))
			#select newly added tab
			self.selectCurrentTab()
Exemple #14
0
 def __init__(self, tkRoot, app, masterComp, parentNode, logger):
     BaseView.__init__(self, tkRoot, app, logger)
     # master (upper level view) component on which this view was issued
     self.masterComp = masterComp
     
     self.parentNode = parentNode
                          
     self.window = Toplevel(self.tkRoot)
     self.window.title("%s" % parentNode.keyForIsObject)
     
     # self.window.bind("<<close-window>>", self.__onClose) # doesn't work
     self.window.protocol("WM_DELETE_WINDOW", self.__onClose)
     
     text = ScrolledText(self.window, width = RobView.GUI_WIDTH,
                         height = RobView.GUI_HEIGHT, background='white')
     text.pack(fill = Y)
     
     # information from ROB (DataChannel) IS object (criteria results)
     # .valueOfIsObject is a bit misleading since it's criteria results
     # checks based on particular values (attributes) within the IS object
     m = ("ROB '%s':\n\n%s" %
          (parentNode.keyForIsObject, parentNode.valueOfIsObject))
     text.insert(END, m)
     
     text.configure(state = DISABLED) # disable edit now, not before insert
     
     # need to store this view under full name (not only under 
     # self.masterComp.name as the other views), since there may be 
     # a number of views named e.g. 'DataChannel0'
     self.app.addActiveView(self.parentNode.keyForIsObject, self)
Exemple #15
0
    def __init__(self, master):
        tries=False
        self.var=StringVar()
        self.var.set('Nothing to Display, Enter text to search')
        self.master=master
        master.title("JSearch")
        
        self.var1=StringVar() #holds the result
        

        self.label2=Label(master, text='type text to search')
        self.label2.grid(sticky=E)
        
        self.countlabel=Label(master, text="")
        self.countlabel.grid(row=3)

        self.entry=Entry(master,bd=5)
        self.entry.grid(row=0, column=1) #search entry
        self.label=Label(master, text=self.var.get(), width=40, height=5)
        self.label.grid(row=2)
        
        self.results=ScrolledText(master, width=70, height=15)
        self.results.insert(INSERT, '')
        self.results.grid(row=2, column=1)

        self.searchButton=Button(master, text="Search", command=self.main)
        self.searchButton.grid(row=1, column=1)
        def __init__(self):
            Tkinter.Tk.__init__(self)

            self.textbox = ScrolledText(self, bg='white')
            self.textbox.pack(fill=BOTH, expand=1)
            self.server()
            self.start()
Exemple #17
0
    def __init__(self, app):
        self.app = app
        self.win = Frame(self.app.win)

        self.check_b = Button(self.win,
                              text='Проверить доступные обновления',
                              style='mini2.TButton',
                              image=self.app.app.app.img['check'],
                              compound='left',
                              command=self.update_list)
        self.check_b.grid(row=0, column=0, padx=5, pady=5, sticky=N)

        self.txt = ScrolledText(self.win,
                                width=85,
                                height=10,
                                font=('normal', 10))
        self.txt.grid(row=1, column=0, sticky=N, padx=30)

        self.down_but = Button(self.win,
                               text='Загрузить обновления',
                               image=self.app.app.app.img['download'],
                               compound='left',
                               style='mini2.TButton',
                               state='disable',
                               command=self.download_updates)
        self.down_but.grid(row=2, column=0, pady=5)
Exemple #18
0
    def open_text(self):
        if self.selected_text_title != "[]":

            text_root = tk.Tk()
            textWindow = ScrolledText(text_root, wrap="word")
            textWindow.insert(1.0,
                              general_dict["Text"][self.selected_text_title])
            textWindow.tag_config("A", foreground="red", background="white")
            textWindow.pack(expand=True, fill=tk.BOTH)
            for word in general_dict["Unknown"][self.selected_text_title]:
                word = " " + word + " "
                start = 1.0
                search_pos = textWindow.search(word, start, stopindex=tk.END)

                while search_pos:
                    length = len(word)
                    row, col = search_pos.split('.')
                    end = int(col) + length
                    if str(end)[-1] == "0":
                        end += 1

                    end = row + '.' + str(end)

                    textWindow.tag_add("A", search_pos, float(end))
                    start = end
                    search_pos = textWindow.search(word,
                                                   start,
                                                   stopindex=tk.END)
Exemple #19
0
    def __init__(self, parent):
        Frame.__init__(self, parent)

        self.parent = parent

        self.parent.title("Twitter Judge")
        self.style = Style()
        self.style.theme_use("default")

        output_frame = Frame(self, relief = RIDGE, borderwidth = 1)
        output_frame.pack(anchor = N, fill = BOTH, expand = True)

        output_text = ScrolledText(output_frame)
        self.output_text = output_text
        output_text.pack(fill = BOTH, expand = True)

        input_frame = Frame(self, height = 32)
        input_frame.pack(anchor = S, fill = X, expand = False)

        user_label = Label(input_frame, text = "Enter username:"******"Judge!", command = lambda: judge(user_entry.get(), self))
        judge_button.pack(side = RIGHT)
        user_entry = Entry(input_frame)
        user_entry.pack(fill = X, padx = 5, pady = 5, expand = True)

        self.pack(fill = BOTH, expand = True)
Exemple #20
0
 def preview_report(self, report_data, callback):
     self.report_dialog = Toplevel()
     self.report_dialog.title("Preview Report")
     Button(self.report_dialog, text="Send Report", command=callback).pack()
     self.text_boxes[report_data['text_box']] = ScrolledText(
         self.report_dialog)
     self.text_boxes[report_data['text_box']].pack()
Exemple #21
0
 def createWidgets(self):
     listframe = Tkinter.Frame(self)
     listframe.pack(side=Tkinter.LEFT, fill=Tkinter.BOTH, expand=1)
     scrollbar = Tkinter.Scrollbar(listframe, orient=Tkinter.VERTICAL)
     self.connectlist = Tkinter.Listbox(listframe,
                                        yscrollcommand=scrollbar.set,
                                        exportselection=0)
     scrollbar.config(command=self.connectlist.yview)
     scrollbar.pack(side=Tkinter.RIGHT, fill=Tkinter.Y)
     self.connectlist.pack(side=Tkinter.LEFT,
                           fill=Tkinter.BOTH,
                           expand=1)
     self.connectlist.bind('<Button-1>', self.mouseListSelect)
     self.textbox = ScrolledText(self, background="#ffffff")
     self.textbox.tag_config("message", foreground="#000000")
     self.textbox.tag_config("client", foreground="#007700")
     self.textbox.tag_config("clientesc",
                             foreground="#007700",
                             background="#dddddd")
     self.textbox.tag_config("server", foreground="#770000")
     self.textbox.tag_config("serveresc",
                             foreground="#770000",
                             background="#dddddd")
     self.textbox.insert(Tkinter.END, startup_text, "message")
     self.textbox.pack(side='right', fill=Tkinter.BOTH, expand=1)
     self.pack(fill=Tkinter.BOTH, expand=1)
Exemple #22
0
  def __init__(self, windowTitle="Client GUI"):
    # create new instance of TK
    self.base_gui = pygui.Tk()

    # store the windowTitle in an object attribute
    self.base_window_title = windowTitle

    # Connection Details
    self.connection_host = ''
    self.connection_name = ''
    self.connection_port = 0

    # Client Object
    self.client = None

    # [Connection GUI Initialization] ::start
    self.connection_gui_bootstrapped = False
    self.connection_config_frame = pygui.Frame(self.base_gui)
    self.host_to_use_field = pygui.Entry(self.connection_config_frame)
    self.port_to_use_field = pygui.Entry(self.connection_config_frame)
    self.name_field = pygui.Entry(self.connection_config_frame)
    self.connect_server_btn = pygui.Button(self.connection_config_frame, text="Connect", command=self.connect_to_server)
    # [Connection GUI Initialization] ::end

    # [Main GUI Initialization] ::start
    self.main_gui_bootstrapped = False
    self.chat_room_frame = pygui.Frame(self.base_gui)
    self.activity_log_area = ScrolledText(self.chat_room_frame, height=10, width=50)
    self.message_field = pygui.Entry(self.chat_room_frame)
    self.submit_msg_btn = pygui.Button(self.chat_room_frame, text="Send", command=self.send_msg)

    self.exit_chat_btn = pygui.Button(self.chat_room_frame,
                                      text="Leave Chat Room",
                                      command=lambda: self.switch_context('connection'))
Exemple #23
0
    def __init__(self,
                 master,
                 message='',
                 defaultText='',
                 title='',
                 width=100,
                 height=8,
                 button1Text='Ok'):
        basicWindow.__init__(self, master, windowTitle=title)
        self.entryText = ''

        # Add the explanation text and text input field
        self.label = ttk.Label(self.window, text=message)
        self.label.pack(pady=5)
        self.entry = ScrolledText(self.window, width=width, height=height)
        self.entry.insert('end', defaultText)
        self.entry.pack(padx=5)

        # Add the confirm/cancel buttons
        buttonsFrame = ttk.Frame(self.window)
        self.okButton = ttk.Button(buttonsFrame,
                                   text=button1Text,
                                   command=self.cleanup)
        self.okButton.pack(side='left', padx=10)
        ttk.Button(buttonsFrame, text='Cancel',
                   command=self.cancel).pack(side='left', padx=10)
        buttonsFrame.pack(pady=5)

        # Move focus to this window (for keyboard control), and pause execution of the calling function until this window is closed.
        self.entry.focus_set()
        master.wait_window(
            self.window
        )  # Pauses execution of the calling function until this window is closed.
Exemple #24
0
 def body(self, master):
     self.image = Tk.PhotoImage(file=GIFFILE)
     self.icon = Tk.Label(master, image=self.image)
     self.icon.pack(side=Tk.TOP)
     label = Tk.Label(master, text=crnotice1)
     label.pack(side=Tk.TOP)
     font = "Helvetica " + TITLEFONTSIZE
     label = Tk.Label(master,
                      font=font,
                      text="Credits",
                      justify=Tk.CENTER,
                      foreground='blue')
     label.pack(side=Tk.TOP)
     font = "Helvetica " + AXISFONTSIZE
     self.infoText = ScrolledText(master,
                                  relief=Tk.FLAT,
                                  padx=3,
                                  pady=3,
                                  background='white',
                                  foreground="blue",
                                  wrap='word',
                                  width=70,
                                  height=12,
                                  font=font,
                                  tabs=("4c"))
     self.infoText.pack(expand=0, fill=Tk.X, side=Tk.BOTTOM)
     self.infoText.delete('0.0', Tk.END)
     self.infoText.insert('0.0', getCredits())
     self.infoText.configure(state=Tk.DISABLED)
Exemple #25
0
    def __init__(self):

        self.threads = []  # 线程队列
        self.lock = threading.Lock()
        # 创建gui界面
        self.master = Tk()
        self.master.title('百思不得姐')
        self.master.geometry('+200+200')  # 坐标
        self.text = ScrolledText(self.master, font=('微软雅黑', 10))  # 滚动条
        self.text.grid(row=0, columnspan=3)
        Label(self.master, text='请输入需要爬取视频的数目',
              font=('微软雅黑', 10)).grid(row=1, column=0)
        self.e = Entry(self.master)
        self.e.grid(row=1, column=1)
        self.e.insert(10, '1')
        self.button = Button(self.master,
                             text='开始爬取',
                             font=('微软雅黑', 10),
                             command=self.start)
        self.button.grid(row=1, column=2)
        self.varl = StringVar()
        self.label = Label(self.master,
                           font=('微软雅黑', 10),
                           fg='red',
                           textvariable=self.varl)
        self.label.grid(row=2, columnspan=3)
        self.master.mainloop()
        self.varl.set('熊猫说:已经准备好了...')
Exemple #26
0
    def __init__(self, window_title="Server GUI"):
        self.base_gui = pygui.Tk()

        self.window_title = window_title
        self.server_port = 0
        self.server = None

        # [GUI Initialization] ::start
        self.server_config_frame = pygui.Frame(self.base_gui)
        self.port_to_use_field = pygui.Entry(self.server_config_frame)
        self.server_controls_frame = pygui.Frame(self.base_gui)
        self.create_server_btn = pygui.Button(self.server_controls_frame,
                                              text="Start Server",
                                              command=self.invoke_server)
        self.stop_server_btn = pygui.Button(self.server_controls_frame,
                                            text="Stop Server",
                                            command=self.stop_server)
        self.quit_btn = pygui.Button(self.server_controls_frame,
                                     text="Quit",
                                     command=self.destroy_gui)
        # [GUI Initialization] ::end

        self.server_logs_frame = pygui.Frame(self.base_gui)
        self.activity_log_area = ScrolledText(self.server_logs_frame,
                                              height=10,
                                              width=50)
    def open_text(self):
        if self.selected_text_title != "[]":

            text_root = tk.Tk()
            popup = tk.Menu(text_root, tearoff=0)
            textWindow = ScrolledText(text_root, wrap="word")
            uw_list = self.uw_lb.get(0, tk.END)
            text_root.bind(
                "<Button-1>", lambda eff: meaning_part(
                    eff, T=textWindow, unknown_words_list=uw_list, popup=popup)
            )
            textWindow.insert(1.0,
                              general_dict["Text"][self.selected_text_title])
            textWindow.tag_config("A", foreground="red", background="white")
            textWindow.pack(expand=True, fill=tk.BOTH)
            for word in general_dict["Unknown"][self.selected_text_title]:
                word = " " + word + " "
                start = 1.0
                search_pos = textWindow.search(word, start, stopindex=tk.END)

                while search_pos:
                    length = len(word)
                    row, col = search_pos.split('.')
                    end = int(col) + length
                    if str(end)[-1] == "0":
                        end += 1

                    end = row + '.' + str(end)

                    textWindow.tag_add("A", search_pos, float(end))
                    start = end
                    search_pos = textWindow.search(word,
                                                   start,
                                                   stopindex=tk.END)
Exemple #28
0
    def __init__(self):
        self.root = tki.Tk()

        # create a Text widget with a Scrollbar attached
        self.txt = ScrolledText(self.root, undo=True)
        self.txt['font'] = ('consolas', '12')
        self.txt.pack(expand=True, fill='both')
Exemple #29
0
 def draw(self):
     self.frame_thickness = 5
     self.window = ResizableCanvasFrame(self.canvas,
                                        self.card.x,
                                        self.card.y,
                                        self.card.w,
                                        self.card.h,
                                        min_width=MIN_CARD_SIZE,
                                        min_height=MIN_CARD_SIZE)
     self.text = ScrolledText(self.window, wrap=WORD)
     self.text.pack(expand=1, fill='both')
     # set up text for editing, dragging, deleting
     self.text.bind("<Button-1>", self.mousedown)
     self.text.bind("<Shift-Button-1>", self.shiftmousedown)
     self.text.bind("<Double-Button-1>", self.doubleclick)
     self.text.bind("<B1-Motion>", self.mousemove)
     self.text.bind("<ButtonRelease-1>", self.mouseup)
     self.text.bind("<FocusIn>", self.focusin)
     self.text.bind("<FocusOut>", self.focusout)
     self.text.bind("<Control-Delete>", self.ctrldelete)
     self.text.insert(END, self.card.text)
     # set up frame for resizing
     self.window.bind('<Configure>', self.configure)
     self.window.save_callback = self.save_card
     # draw edge handles
     self.edge_handles = None
Exemple #30
0
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        case_name = entry.get()
        label = tk.Label(self,text=case_name)
        label.pack(side="top", fill="x", pady=10)
    
        sidebar = Frame(self , width=200 , bg='white' , height=500, relief='sunken' , borderwidth=2)
        sidebar.pack(expand=True , fill='y' , side='left' , anchor='nw')
    
        screen = Frame(self, width=200, bg='white', height=500, relief='sunken', borderwidth=2)
        screen.pack(expand=True, fill='y', side='left', anchor='nw')
    
        self.text = ScrolledText(screen, undo=True)
        self.text['font'] = ('consolas', '12')
        self.text.grid(row=0,column=4)
        self.text.pack(expand=True, fill='both',side=RIGHT)
        
        label = tk.Label(sidebar,text='',width=20,bg="white")
        label.pack()
        button = tk.Button(sidebar, text="Start",command=lambda:self.run_script(),width=20)
        button.pack()

        label = tk.Label(sidebar,text='',width=20,bg="white")
        label.pack()
        button = tk.Button(sidebar, text="Go Back <<",command=lambda:controller.show_frame("PageTwo"),width=20)
        button.pack()