예제 #1
0
    def __init__(self, parent, filename):
        "Configure tags and feed file to parser."
        uwide = idleConf.GetOption('main', 'EditorWindow', 'width', type='int')
        uhigh = idleConf.GetOption('main', 'EditorWindow', 'height', type='int')
        uhigh = 3 * uhigh // 4  # lines average 4/3 of editor line height
        Text.__init__(self, parent, wrap='word', highlightthickness=0,
                      padx=5, borderwidth=0, width=uwide, height=uhigh)

        normalfont = self.findfont(['TkDefaultFont', 'arial', 'helvetica'])
        fixedfont = self.findfont(['TkFixedFont', 'monaco', 'courier'])
        self['font'] = (normalfont, 12)
        self.tag_configure('em', font=(normalfont, 12, 'italic'))
        self.tag_configure('h1', font=(normalfont, 20, 'bold'))
        self.tag_configure('h2', font=(normalfont, 18, 'bold'))
        self.tag_configure('h3', font=(normalfont, 15, 'bold'))
        self.tag_configure('pre', font=(fixedfont, 12), background='#f6f6ff')
        self.tag_configure('preblock', font=(fixedfont, 10), lmargin1=25,
                borderwidth=1, relief='solid', background='#eeffcc')
        self.tag_configure('l1', lmargin1=25, lmargin2=25)
        self.tag_configure('l2', lmargin1=50, lmargin2=50)
        self.tag_configure('l3', lmargin1=75, lmargin2=75)
        self.tag_configure('l4', lmargin1=100, lmargin2=100)

        self.parser = HelpParser(self)
        with open(filename) as f:
            contents = f.read().decode(encoding='utf-8')
        self.parser.feed(contents)
        self['state'] = 'disabled'
예제 #2
0
파일: GUI.py 프로젝트: wwg377655460/MyAi
    def initUI(self):
        self.parent.title("Simple")

        self.style = Style()
        self.style.theme_use("default")



        self.textup = Text(self, width=340, height=34)
        self.textup.bind("<KeyPress>", lambda e: "break")
        self.textup.pack()

        self.frame = Frame(self, relief=RAISED, borderwidth=1)
        self.frame.pack(fill=BOTH, expand=1)
        self.pack(fill=BOTH, expand=1)

        Label(self.frame,text = '', width= "350", height="1").pack()
        Label(self.frame,text = '欢迎大家', width= "350", height="1").pack()
        Label(self.frame,text = '', width= "350", height="3").pack()

        self.text = Text(self, width=340, height=3)
        self.text.bind("<Return>", self.sendMes)
        self.text.pack()
        closeButton = Button(self, text="Close")
        closeButton.pack(side=RIGHT, padx=5, pady=5)
        okButton = Button(self, text="OK",
                          command=self.onClick)
        okButton.pack(side=RIGHT)
예제 #3
0
        def __init__(self, *a, **b):

            # Create self as a Text.
            Text.__init__(self, *a, **b)

            # Initialize the ModifiedMixin.
            self._init()
예제 #4
0
    def __init__(self, parent, filename):
        "Configure tags and feed file to parser."
        uwide = idleConf.GetOption('main', 'EditorWindow', 'width', type='int')
        uhigh = idleConf.GetOption('main', 'EditorWindow', 'height', type='int')
        uhigh = 3 * uhigh // 4  # lines average 4/3 of editor line height
        Text.__init__(self, parent, wrap='word', highlightthickness=0,
                      padx=5, borderwidth=0, width=uwide, height=uhigh)

        normalfont = self.findfont(['TkDefaultFont', 'arial', 'helvetica'])
        fixedfont = self.findfont(['TkFixedFont', 'monaco', 'courier'])
        self['font'] = (normalfont, 12)
        self.tag_configure('em', font=(normalfont, 12, 'italic'))
        self.tag_configure('h1', font=(normalfont, 20, 'bold'))
        self.tag_configure('h2', font=(normalfont, 18, 'bold'))
        self.tag_configure('h3', font=(normalfont, 15, 'bold'))
        self.tag_configure('pre', font=(fixedfont, 12), background='#f6f6ff')
        self.tag_configure('preblock', font=(fixedfont, 10), lmargin1=25,
                borderwidth=1, relief='solid', background='#eeffcc')
        self.tag_configure('l1', lmargin1=25, lmargin2=25)
        self.tag_configure('l2', lmargin1=50, lmargin2=50)
        self.tag_configure('l3', lmargin1=75, lmargin2=75)
        self.tag_configure('l4', lmargin1=100, lmargin2=100)

        self.parser = HelpParser(self)
        with open(filename) as f:
            contents = f.read().decode(encoding='utf-8')
        self.parser.feed(contents)
        self['state'] = 'disabled'
예제 #5
0
    def __init__(self, master=None, **kw):

        # Get the filename associated with this widget's contents, if any.
        self.filename = kw.pop('filename', False)

        #Turn on undo, but don't override a passed-in setting.
        kw.setdefault('undo', True)

        #        kw.setdefault('bg', 'white')
        kw.setdefault('wrap', 'word')
        kw.setdefault('font', 'arial 12')

        #Create ourselves as a Tkinter Text
        Text.__init__(self, master, **kw)

        #Initialize our mouse mixin.
        mousebindingsmixin.__init__(self)

        #Add tag config for command highlighting.
        self.tag_config('command', **self.command_tags)

        #Create us a command instance variable
        self.command = ''

        #Activate event bindings. Modify text_bindings in your config
        #file to affect the key bindings and whatnot here.
        for event_sequence, callback_finder in text_bindings.iteritems():
            callback = callback_finder(self)
            self.bind(event_sequence, callback)

        self.tk.call(self._w, 'edit', 'modified', 0)
        self.bind('<<Modified>>', self._beenModified)
        self._resetting_modified_flag = False
예제 #6
0
    def __init__(self, master=None, change_hook=None, **kw):
        self.frame = Frame(master)
        self.vbar = Scrollbar(self.frame)
        self.vbar.pack(side=RIGHT, fill=Y)

        self.hbar = Scrollbar(self.frame, orient=HORIZONTAL)
        self.hbar.pack(side=BOTTOM, fill=X)

        kw.update({'yscrollcommand': self.vbar.set})
        kw.update({'xscrollcommand': self.hbar.set})
        kw.update({'wrap': 'none'})
        Text.__init__(self, self.frame, **kw)
        self.pack(side=LEFT, fill=BOTH, expand=True)
        self.vbar['command'] = self.yview
        self.hbar['command'] = self.xview

        # Copy geometry methods of self.frame without overriding Text
        # methods -- hack!
        text_meths = vars(Text).keys()
        methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()
        methods = set(methods).difference(text_meths)

        for m in methods:
            if m[0] != '_' and m != 'config' and m != 'configure':
                setattr(self, m, getattr(self.frame, m))
    def initUI(self):
        self.parent.title("Image Copy-Move Detection")
        self.style = Style().configure("TFrame", background="#333")
        # self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)

        quitButton = Button(self, text="Open File", command=self.onFilePicker)
        quitButton.place(x=10, y=10)

        printButton = Button(self, text="Detect", command=self.onDetect)
        printButton.place(x=10, y=40)

        self.textBoxFile = Text(self, state='disabled', width=80, height = 1)
        self.textBoxFile.place(x=90, y=10)

        self.textBoxLog = Text(self, state='disabled', width=40, height=3)
        self.textBoxLog.place(x=90, y=40)

        # absolute image widget
        imageLeft = Image.open("resource/empty.png")
        imageLeftLabel = ImageTk.PhotoImage(imageLeft)
        self.labelLeft = Label(self, image=imageLeftLabel)
        self.labelLeft.image = imageLeftLabel
        self.labelLeft.place(x=5, y=100)

        imageRight = Image.open("resource/empty.png")
        imageRightLabel = ImageTk.PhotoImage(imageRight)
        self.labelRight = Label(self, image=imageRightLabel)
        self.labelRight.image = imageRightLabel
        self.labelRight.place(x=525, y=100)

        self.centerWindow()
예제 #8
0
 def __init__(self, parent, scrollbar=True, **kw):
     
     self.parent = parent
     
     frame = Frame(parent)
     frame.pack(fill='both', expand=True)
     
     # text widget
     Text.__init__(self, frame, **kw)
     self.pack(side='left', fill='both', expand=True)
     
     # scrollbar
     if scrollbar:
         scrb = Scrollbar(frame, orient='vertical', command=self.yview) 
         self.config(yscrollcommand=scrb.set)
         scrb.pack(side='right', fill='y')
     
     # pop-up menu
     self.popup = Menu(self, tearoff=0)
     self.popup.add_command(label='Cut', command=self._cut)
     self.popup.add_command(label='Copy', command=self._copy)
     self.popup.add_command(label='Paste', command=self._paste)
     self.popup.add_separator()
     self.popup.add_command(label='Select All', command=self._select_all)
     self.popup.add_command(label='Clear All', command=self._clear_all)
     self.bind('<Button-3>', self._show_popup)
예제 #9
0
        def __init__(self, *a, **b):

            # Create self as a Text.
            Text.__init__(self, *a, **b)

            # Initialize the ModifiedMixin.
            self._init()
예제 #10
0
    def __init__(self,master):
        frame=Frame(master)
        frame.pack(fill=BOTH,expand=True)
        label=Label(frame,text='URL:',fg='green',font=('Courier New',16))
        label.grid(row=0,column=0,sticky=W)
        self.url=''
        self.text=Text(frame,width=60,height=7,font=('Courier New',12))
        self.text.grid(row=1,columnspan=2)

        self.button=Button(frame,text='检测',font=('Courier New',12))
        self.button.grid(row=2,column=1,sticky=E)

        self.response=Text(frame,font=('Courier New',12),width=60,height=10)
        self.response.grid(row=3, column=0,columnspan=2)

        self.msg=StringVar()
        self.result=Label(frame,textvariable=self.msg,fg='blue',font=('Courier New',12))
        self.result.grid(row=4,column=0,columnspan=2,sticky=N+S+W+E)

        self.button.bind('<Button-1>',self.check)
        self.pattern=re.compile('^(?:http|https)://(?:\w+\.)+.+')
        self.header= {

              "User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36"
            }
        self.payload=''
예제 #11
0
    def __init__(self, master=None,  **kw):

        # Get the filename associated with this widget's contents, if any.
        self.filename = kw.pop('filename', False)

        #Turn on undo, but don't override a passed-in setting.
        kw.setdefault('undo', True)

#        kw.setdefault('bg', 'white')
        kw.setdefault('wrap', 'word')
        kw.setdefault('font', 'arial 12')

        #Create ourselves as a Tkinter Text
        Text.__init__(self, master, **kw)

        #Initialize our mouse mixin.
        mousebindingsmixin.__init__(self)

        #Add tag config for command highlighting.
        self.tag_config('command', **self.command_tags)

        #Create us a command instance variable
        self.command = ''

        #Activate event bindings. Modify text_bindings in your config
        #file to affect the key bindings and whatnot here.
        for event_sequence, callback_finder in text_bindings.iteritems():
            callback = callback_finder(self)
            self.bind(event_sequence, callback)

        self.tk.call(self._w, 'edit', 'modified', 0)
        self.bind('<<Modified>>', self._beenModified)
        self._resetting_modified_flag = False
예제 #12
0
	def __init__(self, *args, **kwargs):
		Text.__init__(self, *args, **kwargs)
		self.redirector = WidgetRedirector(self)
		self.insert = \
		self.redirector.register("insert", lambda *args, **kw: "break")
		self.delete = \
		self.redirector.register("delete", lambda *args, **kw: "break")
예제 #13
0
파일: widgets.py 프로젝트: Bovril/pracmln
    def __init__(self, master=None, change_hook=None, **kw):
        self.frame = Frame(master)
        self.vbar = Scrollbar(self.frame)
        self.vbar.pack(side=RIGHT, fill=Y)

        self.hbar = Scrollbar(self.frame, orient=HORIZONTAL)
        self.hbar.pack(side=BOTTOM,fill=X)

        kw.update({'yscrollcommand': self.vbar.set})
        kw.update({'xscrollcommand': self.hbar.set})
        kw.update({'wrap': 'none'})
        Text.__init__(self, self.frame, **kw)
        self.pack(side=LEFT, fill=BOTH, expand=True)
        self.vbar['command'] = self.yview
        self.hbar['command'] = self.xview

        # Copy geometry methods of self.frame without overriding Text
        # methods -- hack!
        text_meths = vars(Text).keys()
        methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()
        methods = set(methods).difference(text_meths)

        for m in methods:
            if m[0] != '_' and m != 'config' and m != 'configure':
                setattr(self, m, getattr(self.frame, m))
    def __init__(self, ifn, iid, pv, pvt, tht, tnt):

        #create a dictionaty to hold all of the issue data 
        self.issue_dictionary = {
                                "file name" : ifn,
                                "issue index" : iid,
                                "project name" : pv,
                                "project version" : pvt,
                                "HW setup" : tht,
                                "tester" : tnt, 
                                "issue summary" : "summary",
                                "issue description" : "description",
                                "issue time" : "time",
                                "issue GPS" : "GPS"
                            }

        #create the Top level that will be the create issue main window 
        self.create_issue_window = Toplevel()
        self.create_issue_window.title("Create issue")

        #issue summary label and text field
        self.issue_summary_label = Label(self.create_issue_window, text = "Summary")
        self.issue_summary_label.grid(row = 1)

        self.issue_summary_text = Text(self.create_issue_window, height = 1, width = 50)
        self.issue_summary_text.insert(END, "Write issue summary here")
        self.issue_summary_text.grid(row = 1, column = 1)

        #create issue description label and text field
        self.issue_description_label = Label(self.create_issue_window, text = "Summary")
        self.issue_description_label.grid(row = 2)

        self.issue_description_text = Text(self.create_issue_window, height = 5, width = 50)
        self.issue_description_text.insert(END, "Write issue description here")
        self.issue_description_text.grid(row = 2, column = 1)

        #Get the time stamps for the created issue
        now = datetime.datetime.now()
        self.issue_datetime_text = Text(self.create_issue_window, height = 1, width = 30)
        self.issue_datetime_text.insert(END, str(now))
        self.issue_datetime_text.grid(row = 3)

        #Get GPS coordinates from the system
        g = geocoder.ip('me')
        print(g.latlng)
        GPScoord = str(g.latlng)

        #Get GPS coordinates (This will be done later)
        self.issue_GPS_text = Text(self.create_issue_window, height = 1, width = 30)
        self.issue_GPS_text.insert(END, GPScoord)
        self.issue_GPS_text.grid(row = 3, column = 1)

        #define the button that will save a created issue and close the window
        self.save_close_issue_button = Button(self.create_issue_window, text = "Save and Close", command = lambda: self.save_issue_method(self.issue_dictionary))
        self.save_close_issue_button.grid(row = 5)

        #define the button that will discard an issue and close the window
        self.save_close_issue_button = Button(self.create_issue_window, text = "Discard", command = self.create_issue_window.destroy)
        self.save_close_issue_button.grid(row = 5, column = 1)
예제 #15
0
 def setUpClass(cls):
     if 'Tkinter' in str(Text):
         requires('gui')
         cls.tk = Tk()
         cls.text = Text(cls.tk)
     else:
         cls.text = Text()
     cls.auto_expand = AutoExpand(Dummy_Editwin(cls.text))
예제 #16
0
 def __init__(self, master, **options):
     Text.__init__(self, master, **options)
     self.config(highlightbackground=background,
                 selectbackground="Dodger Blue",
                 selectforeground="White")
     self.height = options.get("height", 20)
     self.queue = Queue.Queue()
     self.update()
예제 #17
0
    def __init__(self, root=None, **args):

        Text.__init__(self, root, **args)
        self.main = self.master.master
        self.create_syntas_tags()
        self.bind("<Key>", self.update_syntax)

        self.config(maxundo=15, undo=True, bg="white")
        self.update_linenumber()
예제 #18
0
파일: TextBox.py 프로젝트: zoocreet/FoxDot
 def __init__(self, master, **options):
     Text.__init__(self, master, **options)
     self.root = master
     self.config(highlightbackground=background, selectbackground="Dodger Blue", selectforeground="White")
     self.height = options.get("height", 20)
     self.queue = Queue.Queue()
     self.lines = 0 # number of lines in the text
     self.modifying = False
     self.update()
예제 #19
0
 def __init__(self, *args, **kwdargs):
     Text.__init__(self, *args, **kwdargs)
     self.redirector = WidgetRedirector(self)
     self.insert = self.redirector.register("insert",
                                            lambda *args, **kw: "break")
     self.delete = self.redirector.register("delete",
                                            lambda *args, **kw: "break")
     self.replace = self.redirector.register("replace",
                                             lambda *args, **kw: "break")
예제 #20
0
   def __init__(self, *args, **kwargs):
     """
 initialize our specialized tkinter Text widget
 """
     Text.__init__(self, *args, **kwargs)
     self.known_tags = set([])
     # register a default color tag
     self.register_tag("30", "White", "Black")
     self.reset_to_default_attribs()
 def __init__(self, parent):
   """
   initialize our specialized tkinter Text widget
   """
   Text.__init__(self, parent)
   self.known_tags = set([])
   self.configure(background="Black")
   # register a default color tag
   self.register_tag("30", "White", "Black")
   self.reset_to_default_attribs()
예제 #22
0
    def createWidgets(self):
        self.consoleLabel = Label(self, text="Console")
        self.consoleLabel.grid(row=0, column=0, sticky="nsew")

        self.console = Text(self)
        self.console.grid(row=1, column=0, sticky="nsew")

        self.errorLabel = Label(self, text="Errors:")
        self.errorLabel.grid(row=2, column=0, sticky="nsew")

        self.errorText = Text(self, state="disabled")
        self.errorText.grid(row=3, column=0, sticky="nsew")
예제 #23
0
 def __init__(self, api, text='', id=None):
     self.master = Tk()
     self.id = id
     self.api = api
     Text.__init__(self, self.master, bg='#f9f3a9', wrap='word', undo=True)
     self.bind('<Control-n>', self.create)
     self.bind('<Control-s>', self.save)
     if id:
         self.master.title('#%d' % id)
     self.delete('1.0', 'end')
     self.insert('1.0', text)
     self.master.geometry('220x235')
     self.pack(fill='both', expand=1)
예제 #24
0
파일: inputrecorder.py 프로젝트: 01org/pem
 def __init__(self, *args, **kwargs):
     """
     Trashes every attempt to modify the text area coming from
     user input.
     """
     Text.__init__(self, *args, **kwargs)
     self.redirector = WidgetRedirector(self)
     self.insert = \
         self.redirector.register("insert",
                                  lambda *args, **kw: "break")
     self.delete = \
         self.redirector.register("delete",
                                  lambda *args, **kw: "break")
 def __init__(self, api, text="", id=None):
     self.master = Tk()
     self.id = id
     self.api = api
     Text.__init__(self, self.master, bg="#f9f3a9", wrap="word", undo=True)
     self.bind("<Control-n>", self.create)
     self.bind("<Control-s>", self.save)
     if id:
         self.master.title("#%d" % id)
     self.delete("1.0", "end")
     self.insert("1.0", text)
     self.master.geometry("220x235")
     self.pack(fill="both", expand=1)
예제 #26
0
 def __init__(self, *args, **kwargs):
     """
     Trashes every attempt to modify the text area coming from
     user input.
     """
     Text.__init__(self, *args, **kwargs)
     self.redirector = WidgetRedirector(self)
     self.insert = \
         self.redirector.register("insert",
                                  lambda *args, **kw: "break")
     self.delete = \
         self.redirector.register("delete",
                                  lambda *args, **kw: "break")
예제 #27
0
    def createWidgets(self):
        self.browse_button = Button(self,
                                    text="Browse",
                                    command=self.askopenfile,
                                    width=10).pack()
        #         self.browse_button.grid()

        self.diff_text_box = Text(self, height=10, width=300).pack()
        #         self.diff_text_box.grid()

        self.actual_text_box = Text(self, height=50, width=100).pack()
        #         self.actual_text_box.grid()

        self.expected_text_box = Text(self, height=50, width=100).pack()
예제 #28
0
 def __init__(self, master = None, **kw):
     self.frame = Frame(master)
     self.vbar = Scrollbar(self.frame)
     self.vbar.pack(side=RIGHT, fill=Y)
     kw.update({'yscrollcommand': self.vbar.set})
     Text.__init__(self, self.frame, **kw)
     self.pack(side=LEFT, fill=BOTH, expand=True)
     self.vbar['command'] = self.yview
     text_meths = vars(Text).keys()
     methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()
     methods = set(methods).difference(text_meths)
     for m in methods:
         if m[0] != '_' and m != 'config' and m != 'configure':
             setattr(self, m, getattr(self.frame, m))
예제 #29
0
 def __init__(self, master=None, **kw):
     self.frame = Frame(master)
     self.vbar = Scrollbar(self.frame)
     self.vbar.pack(side=RIGHT, fill=Y)
     kw.update({'yscrollcommand': self.vbar.set})
     Text.__init__(self, self.frame, **kw)
     self.pack(side=LEFT, fill=BOTH, expand=True)
     self.vbar['command'] = self.yview
     text_meths = vars(Text).keys()
     methods = vars(Pack).keys() + vars(Grid).keys() + vars(Place).keys()
     methods = set(methods).difference(text_meths)
     for m in methods:
         if m[0] != '_' and m != 'config' and m != 'configure':
             setattr(self, m, getattr(self.frame, m))
예제 #30
0
 def __init__(self, parent, data_model=None, key=None, context_manager=None, tcl_buffer_size=100, tcl_buffer_low_cutoff=0.25,
              tcl_buffer_high_cutoff=0.75, tcl_moveto_yview=0.50, max_lines_jump=10, **kwargs):
     Text.__init__(self, parent, **kwargs)
     self.scroller = None
     self.context_manager = context_manager
     self.TCL_BUFFER_SIZE = tcl_buffer_size
     self.TCL_BUFFER_LOW_CUTOFF = tcl_buffer_low_cutoff
     self.TCL_BUFFER_HIGH_CUTOFF = tcl_buffer_high_cutoff
     self.TCL_MOVETO_YVIEW = tcl_moveto_yview
     self.MAX_LINES_JUMP = max_lines_jump
     self.reset()
     self.data_model = data_model
     self.key = key
     self.setCursor(START)
예제 #31
0
    def initUI(self):
        #create initial Beings object (not instantiated until live is called)
        self.wc = WorldConfiguration()

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

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

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

        self.world = Canvas(self, background="#7474DB")
        self.world.grid(row=1,
                        column=0,
                        columnspan=3,
                        rowspan=8,
                        padx=5,
                        sticky=E + W + N + S)

        self.sbtn = Button(self, text="Stop")
        self.sbtn.grid(row=1, column=4, pady=5, sticky=E)

        self.bbox = Text(self, height=20, width=36)
        self.bbox.grid(row=3, column=4, padx=5, sticky=E + W + N + S)

        self.bbox1 = Text(self, height=11, width=36)
        self.bbox1.grid(row=4, column=4, padx=5, sticky=E + W + N + S)

        self.cbtn = Button(self, text="Close", command=self.parent.destroy)
        self.cbtn.grid(row=9, column=4, pady=5)

        self.cnfbtn = Button(self, text="Configure Universe")
        self.cnfbtn.grid(row=9, column=0, padx=5)

        self.timelbl = Text(self, height=1, width=10)
        self.timelbl.grid(row=2, column=4, pady=5)

        b = Beings(self)
        abtn = Button(
            self, text="Start", command=b.live
        )  #Beings(cnfbtn, world, 4, 10, sbtn, bbox, bbox1, timelbl).live)
        abtn.grid(row=1, column=4, pady=5, sticky=W)

        self.cnfbtn.config(command=b.configure)
예제 #32
0
    def CreateWidgets(self):
        frameText = Frame(self, relief=SUNKEN, height=700)
        frameButtons = Frame(self)
        self.buttonOk = Button(frameButtons,
                               text='Close',
                               command=self.Ok,
                               takefocus=False)
        self.scrollbarView = Scrollbar(frameText,
                                       orient=VERTICAL,
                                       takefocus=False)
        self.textView = Text(frameText,
                             wrap=WORD,
                             fg=self.fg,
                             bg=self.bg,
                             highlightthickness=0)
        self.scrollbarView.config(command=self.textView.yview)
        self.textView.config(yscrollcommand=self.scrollbarView.set)
        self.buttonOk.pack()
        self.scrollbarView.pack(side=RIGHT, fill=Y)
        self.textView.pack(side=LEFT, expand=True, fill=BOTH)
        frameButtons.pack(side=BOTTOM)
        frameText.pack(side=TOP, expand=True, fill=BOTH)

        if TTK:
            frameButtons['style'] = 'RootColor.TFrame'
예제 #33
0
    def __init__(self, master, width=0, height=0, family=None, size=None,*args, **kwargs):
        
        Frame.__init__(self, master, width = width, height= height)
        self.pack_propagate(False)

        self._min_width = width
        self._min_height = height

        self._textarea = Text(self, *args, **kwargs)
        self._textarea.pack(expand=True, fill='both')

        if family != None and size != None:
            self._font = tkFont.Font(family=family,size=size)
        else:
            self._font = tkFont.Font(family=self._textarea.cget("font"))

        self._textarea.config(font=self._font)

        # I want to insert a tag just in front of the class tag
        # It's not necesseary to guive to this tag extra priority including it at the beginning
        # For this reason I am making this search
        self._autoresize_text_tag = "autoresize_text_"+str(id(self))
        list_of_bind_tags = list(self._textarea.bindtags())
        list_of_bind_tags.insert(list_of_bind_tags.index('Text'), self._autoresize_text_tag)

        self._textarea.bindtags(tuple(list_of_bind_tags))
        self._textarea.bind_class(self._autoresize_text_tag, "<KeyPress>",self._on_keypress)
예제 #34
0
    def build(self):
        text = _(
            'sK1 generates PDF file as a printing output. So as a printing target you can use any application \
which accepts PDF file on input: evince, kprinter, acroread etc. \
Printing command should contain %f symbols replaced by \
temporal PDF file name during printing.')
        label = Text(self, height=5, wrap=WORD)
        label.pack(side=TOP, anchor='nw')
        label.insert(END, text)

        frame = FlatFrame(self)
        frame.pack(side=TOP, fill=X, expand=1, pady=10)

        frame.columnconfigure(1, weight=1)

        label = Label(frame, text=_('Printing command:'), justify=LEFT)
        label.grid(column=0, row=0, sticky='w')

        combo = TCombobox(frame,
                          state='normal',
                          values=self.prn_commandrs,
                          style='ComboNormal',
                          textvariable=self.var_print_command)  #, width=30)
        combo.grid(column=1, row=0, sticky='we', pady=5, padx=10)

        label = Label(frame, text=_('Output PDF level:'), justify=LEFT)
        label.grid(column=0, row=1, sticky='w')

        combo = TCombobox(frame,
                          state='readonly',
                          values=self.levels,
                          style='ComboNormal',
                          width=10,
                          textvariable=self.var_pdf_level)
        combo.grid(column=1, row=1, sticky='w', pady=5, padx=10)
예제 #35
0
    def initUI(self):

        self.parent.title("AUTO TIPS")
        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="Status")
        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="Drive Command", command=win3)
        abtn.grid(row=1, column=3)

        cbtn = Button(self, text="Tester Manual Control", command=win2)
        cbtn.grid(row=2, column=3, pady=4)

        dbtn = Button(self, text="Auto Run", command=AutoTIPS)
        dbtn.grid(row=3, column=3, pady=4)

        obtn = Button(self, text="OK", command=self.parent.destroy)
        obtn.grid(row=5, column=3)
예제 #36
0
    def create_status_controls(self):
        """
        Bottom layout, text status controls for letting the user know what the current state is.
        """
        # Status text for currently selected directory or file.
        self.status_text = StringVar()
        self.status_label = Label(self.top_bottom_frame,
                                  textvariable=self.status_text)
        self.status_text.set(
            'Use controls above to select a source to be modified')
        self.status_label.grid(row=0, column=0)

        # Progress text controls, outputs full logs from libs.
        self.progress_text = Text(self.bottom_frame, height=8, width=60)
        # Add visible scrollbar.
        self.scrollbar = Scrollbar(self.bottom_frame,
                                   command=self.progress_text.yview)
        self.progress_text.configure(yscrollcommand=self.scrollbar.set)
        # Define custom tags for text format.
        self.progress_text.tag_config('bold',
                                      background='black',
                                      foreground='green',
                                      font=('Arial', 12, 'bold'))
        self.progress_text.tag_config('big',
                                      background='black',
                                      foreground='green',
                                      font=('Arial', 20, 'bold'))
        self.progress_text.tag_config('default',
                                      foreground='red',
                                      font=('Courier', 11))
        # Set initial empty text and position.
        self.update_progress_text('')
        self.progress_text.grid(row=0, column=0, sticky='nsew')
        # Add North and South to the scrollbar so it streches in vertical direction.
        self.scrollbar.grid(column=1, row=0, sticky=N + S + W)
예제 #37
0
def start():
    menu = Tk()
    button1 = Button(menu, text="Add New Recipe", command=createRecipe)
    button1.grid(row=0, column=0)
    button2 = Button(menu, text="Export Recipe")
    button2.grid(row=1, column=0)
    button3 = Button(menu, text="My Recipes", command=recipebox)
    button3.grid(row=2, column=0)
    button4 = Button(menu, text="Recently Viewed")
    button4.grid(row=3, column=0)
    button5 = Button(menu, text="Favourites", command=FavsWnd)
    button5.grid(row=0, column=5)
    button6 = Button(menu, text="Grocery List", command=openGrocery)
    button6.grid(row=0, column=2)
    button7 = Button(menu, text="Hungry?")
    button7.grid(row=0, column=3)
    search = Label(menu, text="Search by:")
    search.grid(row=0, column=6)
    filter1 = Button(menu, text="Recipe Name")
    filter1.grid(row=1, column=6)
    filter2 = Button(menu, text="Ingredient")
    filter2.grid(row=2, column=6)
    filter3 = Button(menu, text="User")
    filter3.grid(row=3, column=6)
    button8 = Button(menu, text="Notifications")
    button8.grid(row=0, column=4)
    newsfeed = Label(menu, text="Newsfeed")
    newsfeed.grid(row=0, column=1)
    cookbook = Button(menu, text="Main Cookbook", command=All_recipes)
    cookbook.grid(row=1, column=4)
    Txt = Text(menu, height="20")
    Txt.grid(row=1, column=1)
    menu.mainloop()
예제 #38
0
    def initUI(self):

        self.parent.title("Review")
        self.pack(fill=BOTH, expand=True)

        frame1 = Frame(self)
        frame1.pack(fill=X)

        lbl1 = Label(frame1, text="Title", width=6)
        lbl1.pack(side=LEFT, padx=5, pady=5)

        entry1 = Entry(frame1)
        entry1.pack(fill=X, padx=5, expand=True)

        frame2 = Frame(self)
        frame2.pack(fill=X)

        lbl2 = Label(frame2, text="Author", width=6)
        lbl2.pack(side=LEFT, padx=5, pady=5)

        entry2 = Entry(frame2)
        entry2.pack(fill=X, padx=5, expand=True)

        frame3 = Frame(self)
        frame3.pack(fill=BOTH, expand=True)

        lbl3 = Label(frame3, text="Review", width=6)
        lbl3.pack(side=LEFT, anchor=N, padx=5, pady=5)

        txt = Text(frame3)
        txt.pack(fill=BOTH, pady=5, padx=5, expand=True)
예제 #39
0
def _replace_dialog(parent):
    root = Tk()
    root.title("Test ReplaceDialog")
    width, height, x, y = list(map(int, re.split('[x+]', parent.geometry())))
    root.geometry("+%d+%d" % (x, y + 150))

    # mock undo delegator methods
    def undo_block_start():
        pass

    def undo_block_stop():
        pass

    text = Text(root)
    text.undo_block_start = undo_block_start
    text.undo_block_stop = undo_block_stop
    text.pack()
    text.insert("insert", "This is a sample string.\n" * 10)

    def show_replace():
        text.tag_add(SEL, "1.0", END)
        replace(text)
        text.tag_remove(SEL, "1.0", END)

    button = Button(root, text="Replace", command=show_replace)
    button.pack()
예제 #40
0
    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,
                  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)
예제 #41
0
    def varcaller(self):
        self.vc = ttk.Labelframe(self.inwin, text='Variant Caller')
        self.vc.place(x=self.x0, y=self.y0 + 215, height=150, width=600)
        vlabel = ["Aligner"]
        valv = ["bwa mem"]
        aligner, self.vstr, vref = [0] * 2, [0] * 2, [0] * 2
        xvl, xrl = 5, 70
        for i in range(len(valv)):
            aligner[i] = Label(self.vc, text=vlabel[i])
            aligner[i].place(x=xvl, y=10)
            self.vstr[i] = StringVar(self.vc)
            self.vstr[i].set(valv[i])  # default value
            vref[i] = OptionMenu(self.vc, self.vstr[i], valv[i])
            vref[i].place(x=xrl, y=5)
            xvl += 190
            xrl += 195

        self.sam = Label(self.vc, text="Samtools")
        self.sam.place(x=5, y=70)

        self.sam_entry = Text(self.vc)
        self.sam_entry.place(x=70, y=55, height=50, width=450)
        self.sam_entry.insert(
            END,
            'samtools mpileup -uBg --max-depth 100000 --min-MQ minMappingQuality --min-BQ minBaseQuality -f RefGenome $1.sorted.bam|bcftools call --ploidy 1 --skip-variants indels --multiallelic-caller > $1_caller.vcf'
        )
        self.sam_entry.configure(state='disabled', wrap='word')
예제 #42
0
def main():
    class Tracer(Delegator):
        def __init__(self, name):
            self.name = name
            Delegator.__init__(self, None)

        def insert(self, *args):
            print self.name, ": insert", args
            self.delegate.insert(*args)

        def delete(self, *args):
            print self.name, ": delete", args
            self.delegate.delete(*args)

    root = Tk()
    root.wm_protocol("WM_DELETE_WINDOW", root.quit)
    text = Text()
    text.pack()
    text.focus_set()
    p = Percolator(text)
    t1 = Tracer("t1")
    t2 = Tracer("t2")
    p.insertfilter(t1)
    p.insertfilter(t2)
    root.mainloop()
    p.removefilter(t2)
    root.mainloop()
    p.insertfilter(t2)
    p.removefilter(t1)
    root.mainloop()
예제 #43
0
	def __init__(self, root, **kwargs):
		Text.__init__(self, root, **kwargs)
예제 #44
0
    def  __init__(self):


        self.root = tk.Tk()
        self.frame = tk.Frame(self.root)
        self.frame.pack(fill='both', expand=True)

        # text widget
        #self.text = tk.Text(self.frame, borderwidth=3, relief="sunken")
        Text.__init__(self, self.frame, borderwidth=3, relief="sunken")
        self.config(tabs=(400,))  # configure Text widget tab stops
        self.config(background = 'black', foreground = 'white', font= ("consolas", 12), wrap = 'word', undo = 'True')
#        self.config(background = 'black', foreground = 'white', font= ("consolas", 12), wrap = 'none', undo = 'True')
        self.config(height  = 24, width = 100)
        self.config(insertbackground = 'pale green')  # keyboard insertion point
        self.pack(side='left', fill='both', expand=True)

        self.tag_config('normal', foreground = 'white')
        self.tag_config('warning', foreground = 'yellow' )
        self.tag_config('error', foreground = 'red')
        self.tag_config('highlight_green', foreground = 'green')
        self.tag_config('highlight_blue', foreground = 'cyan')
        self.tag_config('error_highlight_inactive', background = 'dim gray')
        self.tag_config('error_highlight_active', background = 'light grey')

        self.bind_class("Text","<Control-a>", self.select_all)  # required in windows, works in others
        self.bind_all("<Control-Shift-E>", self.scroll_errors)
        self.bind_class("<Control-Shift-R>", self.rebuild)

        # scrollbar

        scrb = tk.Scrollbar(self.frame, orient='vertical', command=self.yview)
        self.config(yscrollcommand=scrb.set)
        scrb.pack(side='right', fill='y')

#        self.scrb_Y = tk.Scrollbar(self.frame, orient='vertical', command=self.yview)
#        self.scrb_Y.config(yscrollcommand=self.scrb_Y.set)
#        self.scrb_Y.pack(side='right', fill='y')
#
#        self.scrb_X = tk.Scrollbar(self.frame, orient='horizontal', command=self.xview)
#        self.scrb_X.config(xscrollcommand=self.scrb_X.set)
#        self.scrb_X.pack(side='bottom', fill='x')

#        scrb_X = tk.Scrollbar(self, orient=tk.HORIZONTAL, command=self.xview)  # tk.HORIZONTAL now have a horizsontal scroll bar BUT... shrinks it to a postage stamp and hides far right behind the vertical scroll bar
#        self.config(xscrollcommand=scrb_X.set)
#        scrb_X.pack(side='bottom', fill='x')
#
#        scrb= tk.Scrollbar(self, orient='vertical', command=self.yview)
#        self.config(yscrollcommand=scrb.set)
#        scrb.pack(side='right', fill='y')

#        self.config(height  = 240, width = 1000)            # didn't get the size baCK TO NORMAL
#        self.pack(side='left', fill='both', expand=True)    # didn't get the size baCK TO NORMAL


        # pop-up menu
        self.popup = tk.Menu(self, tearoff=0)

        self.popup.add_command(label='Copy', command=self._copy)
        self.popup.add_command(label='Paste', command=self._paste)
        self.popup.add_separator()
        self.popup.add_command(label='Cut', command=self._cut)
        self.popup.add_separator()
        self.popup.add_command(label='Select All', command=self._select_all)
        self.popup.add_command(label='Clear All', command=self._clear_all)
        self.popup.add_separator()
        self.popup.add_command(label='Save As', command=self._file_save_as)
        self.popup.add_separator()
 #       self.popup.add_command(label='Repeat Build(CTL-shift-r)', command=self._rebuild)
        self.popup.add_command(label='Repeat Build', command=self._rebuild)
        self.popup.add_separator()
        self.popup.add_command(label='Scroll Errors (CTL-shift-e)', command=self._scroll_errors)
        self.popup.add_separator()
        self.popup.add_command(label='Open File at Cursor', command=self._open_selected_file)

        if current_OS == 'Darwin':  # MAC
          self.bind('<Button-2>', self._show_popup)  # macOS only
        else:
          self.bind('<Button-3>', self._show_popup)  # Windows & Linux
예제 #45
0
 def __init__(self, root):
     Text.__init__(self, bd=0, width=600, highlightthickness=0)
     self.master = root
     self.focus_force()
     self.pack()
예제 #46
0
파일: widgets.py 프로젝트: Bovril/pracmln
 def insert(self, index, text, *args):
     line = int(self.index(index).split(".")[0])
     Text.insert(self, index, text, *args)
     for i in range(text.count("\n")):
         self.colorize(str(line+i))
예제 #47
0
 def __init__(self, master, **options):
     Text.__init__(self, master, **options)
     self.queue = Queue.Queue()
     self.check_queue()
예제 #48
0
파일: widgets.py 프로젝트: Bovril/pracmln
 def disable(self, disable):
     Text.config(self, state=DISABLED if disable else NORMAL)
 def __init__(self, *args, **kwargs):
     Text.__init__(self, *args, **kwargs)
예제 #50
0
 def __init__(self, parent):
     Text.__init__(self, parent)
예제 #51
0
 def __init__(self, *a, **b):
     Text.__init__(self, *a, **b)
     self._init()
예제 #52
0
파일: TextBox.py 프로젝트: Qirky/FoxDot
 def __init__(self, master, **options):
     Text.__init__(self, master, **options)
     self.queue = Queue.Queue()
     self.update()