예제 #1
1
    def __init__ (self, master=None, widgetName=None,
		  static_options=None, cnf={}, kw={}):
	# Merge keywords and dictionary arguments
	if kw:
	    cnf = _cnfmerge((cnf, kw))
	else:
	    cnf = _cnfmerge(cnf)

	# Move static options into extra. static_options must be
	# a list of keywords (or None).
	extra=()
	if static_options:
	    for k,v in cnf.items()[:]:
		if k in static_options:
		    extra = extra + ('-' + k, v)
		    del cnf[k]

	self.widgetName = widgetName
	Widget._setup(self, master, cnf)

	# If widgetName is None, this is a dummy creation call where the
	# corresponding Tk widget has already been created by Tix
	if widgetName:
	    apply(self.tk.call, (widgetName, self._w) + extra)

	# Non-static options - to be done via a 'config' command
	if cnf:
	    Widget.config(self, cnf)

	# Dictionary to hold subwidget names for easier access. We can't
	# use the children list because the public Tix names may not be the
	# same as the pathname component
	self.subwidget_list = {}
예제 #2
0
    def __init__(self,
                 master=None,
                 widgetName=None,
                 static_options=None,
                 cnf={},
                 kw={}):
        if kw:
            cnf = _cnfmerge((cnf, kw))
        else:
            cnf = _cnfmerge(cnf)
        extra = ()
        if static_options:
            static_options.append('options')
        else:
            static_options = ['options']
        for k, v in cnf.items()[:]:
            if k in static_options:
                extra = extra + ('-' + k, v)
                del cnf[k]

        self.widgetName = widgetName
        Widget._setup(self, master, cnf)
        if widgetName:
            self.tk.call(widgetName, self._w, *extra)
        if cnf:
            Widget.config(self, cnf)
        self.subwidget_list = {}
예제 #3
0
	def __init__(self, master=None, cnf={}, **kw):
		cnf = _cnfmerge((cnf, kw))
		labelCnf, cnf = _splitCnf('label_', _cnfmerge((cnf, kw)))
		WidgetWrapper.__init__(self, master)
		self.label = Tk.Label(self.super, labelCnf)
		self.label.pack(side=Tk.BOTTOM, fill=Tk.X)
		Tk.Button.__init__(self, self.super, cnf)
		Tk.Button.pack(self, side=Tk.TOP, fill=Tk.BOTH, expand=Tk.TRUE)
예제 #4
0
 def __init__(self, master=None, cnf={}, **kw):
     cnf = _cnfmerge((cnf, kw))
     labelCnf, cnf = _splitCnf('label_', _cnfmerge((cnf, kw)))
     WidgetWrapper.__init__(self, master)
     self.label = Tk.Label(self.super, labelCnf)
     self.label.pack(side=Tk.BOTTOM, fill=Tk.X)
     Tk.Button.__init__(self, self.super, cnf)
     Tk.Button.pack(self, side=Tk.TOP, fill=Tk.BOTH, expand=Tk.TRUE)
예제 #5
0
 def tix_configure(self, cnf=None, **kw):
     if kw:
         cnf = _cnfmerge((cnf, kw))
     elif cnf:
         cnf = _cnfmerge(cnf)
     if cnf is None:
         return self._getconfigure('tix', 'configure')
     else:
         return self._getconfigure1(
             'tix', 'configure', '-' + cnf) if isinstance(
                 cnf, StringType) else self.tk.call(('tix', 'configure') +
                                                    self._options(cnf))
예제 #6
0
 def __init__(self, master=None, cnf={}, **kw):
     labelCnf, cnf = _splitCnf('label_', _cnfmerge((cnf, kw)))
     WidgetWrapper.__init__(self, master)
     self.label = Tk.Label(self.super, labelCnf)
     self.label.pack(side=Tk.LEFT, fill=Tk.Y)
     Tk.Text.__init__(self, self.super, cnf)
     Tk.Text.pack(self, side=Tk.RIGHT, fill=Tk.BOTH, expand=Tk.TRUE)
    def __init__(self, master=None, cnf=None, **kw):
        if cnf is None:
            cnf = {}
        if kw:
            cnf = _cnfmerge((cnf, kw))
        fcnf = {}
        for k in cnf.keys():
            if type(k) == ClassType or k == 'name':
                fcnf[k] = cnf[k]
                del cnf[k]
        self.frame = Frame(master, **fcnf)
        self.vbar = Scrollbar(self.frame, name='vbar')
        self.vbar.pack(side=RIGHT, fill=Y)
        cnf['name'] = 'text'
        Text.__init__(self, self.frame, **cnf)
        self.pack(side=LEFT, fill=BOTH, expand=1)
        self['yscrollcommand'] = self.vbar.set
        self.vbar['command'] = self.yview

        # Copy geometry methods of self.frame -- hack!
        methods = Pack.__dict__.keys()
        methods = methods + Grid.__dict__.keys()
        methods = methods + Place.__dict__.keys()

        for m in methods:
            if m[0] != '_' and m != 'config' and m != 'configure':
                setattr(self, m, getattr(self.frame, m))
예제 #8
0
    def __init__(self, master=None, cnf=None, **kw):
        if cnf is None:
            cnf = {}
        if kw:
            cnf = _cnfmerge((cnf, kw))
        fcnf = {}
        for k in cnf.keys():
            if type(k) == ClassType or k == "name":
                fcnf[k] = cnf[k]
                del cnf[k]
        self.frame = Frame(master, **fcnf)
        self.vbar = Scrollbar(self.frame, name="vbar")
        self.vbar.pack(side=RIGHT, fill=Y)
        cnf["name"] = "text"
        Text.__init__(self, self.frame, **cnf)
        self.pack(side=LEFT, fill=BOTH, expand=1)
        self["yscrollcommand"] = self.vbar.set
        self.vbar["command"] = self.yview

        # Copy geometry methods of self.frame -- hack!
        methods = Pack.__dict__.keys()
        methods = methods + Grid.__dict__.keys()
        methods = methods + Place.__dict__.keys()

        for m in methods:
            if m[0] != "_" and m != "config" and m != "configure":
                setattr(self, m, getattr(self.frame, m))
예제 #9
0
    def __init__(self, master=None, cnf=None, **kw):
        if cnf is None:
            cnf = {}
        if kw:
            cnf = _cnfmerge((cnf, kw))
        fcnf = {}
        for k in cnf.keys():
            if type(k) == ClassType or k == 'name':
                fcnf[k] = cnf[k]
                del cnf[k]
        self.frame = Frame(master, **fcnf)
        self.vbar = AutoScrollbar(self.frame, name='vbar')
        self.vbar.grid(row=0, column=1, sticky=N+S)
        #self.vbar.pack(side=RIGHT, fill=Y)
        cnf['name'] = 'text'
        Text.__init__(self, self.frame, **cnf)        
        self.grid(row=0, column=0, sticky=N+S+E+W)
        #self.pack(side=LEFT, fill=BOTH, expand=1)
        self['yscrollcommand'] = self.vbar.set
        self.vbar['command'] = self.yview

        self.master.grid_rowconfigure(0, weight=1)
        self.master.grid_columnconfigure(0, weight=1)


        # Copy geometry methods of self.frame -- hack!
        methods = Pack.__dict__.keys()
        methods = methods + Grid.__dict__.keys()
        methods = methods + Place.__dict__.keys()

        for m in methods:
            if m[0] != '_' and m != 'config' and m != 'configure':
                setattr(self, m, getattr(self.frame, m))
예제 #10
0
    def __init__(self, master=None, cnf={}, **kw):
        """Construct a new Molecule dock with the parent master.

        Valid resource names: background, bd, bg, borderwidth, class,
        colormap, container, cursor, height, highlightbackground,
        highlightcolor, highlightthickness, relief, takefocus, visual, width."""

        # get the number of columns to use in the viewer
        if kw.has_key("cols"):
            self.cols = kw["cols"]
            del kw["cols"]
        else:
            self.cols = 2

        cnf = _cnfmerge((cnf, kw))
        ScrollingFrame.__init__(self, master)

        # now add the internal Scrolling Frame
        self._int = Frame(self)
        self._int.pack(expand=1, fill=BOTH)

        # current row and column
        self.r = 0
        self.c = -1
        for col in range(self.cols):
            self._int.grid_columnconfigure(col, weight=1)
        self._int.grid_rowconfigure(self.r, weight=1)
예제 #11
0
    def __init__(self, master=None, cnf={}, **kw):
        WidgetWrapper.__init__(self, master)
        xscrollCnf, cnf = _splitCnf('xscrollbar_', _cnfmerge((cnf, kw)))
        yscrollCnf, cnf = _splitCnf('yscrollbar_', cnf)
        self._xscroll = Tk.Scrollbar(self.super,
                                     xscrollCnf,
                                     orient=Tk.HORIZONTAL,
                                     command=self.xview)
        self._yscroll = Tk.Scrollbar(self.super,
                                     yscrollCnf,
                                     command=self.yview)
        Tk.Text.__init__(self,
                         self.super,
                         cnf,
                         wrap=Tk.NONE,
                         xscrollcommand=self._xset,
                         yscrollcommand=self._yset)
        self._hasXScroll = False
        self._hasYScroll = False
        self._skipReset = False
        self.bind('<Configure>', self._reset)
        #self.bind('<<Modified>>', self._monitor)

        self.super.grid_rowconfigure(0, weight=1)
        self.super.grid_columnconfigure(0, weight=1)

        Tk.Text.grid(self, row=0, column=0, sticky='nesw')
예제 #12
0
	def __init__(self, master=None, cnf={}, **kw):
		labelCnf, cnf = _splitCnf('label_', _cnfmerge((cnf, kw)))
		WidgetWrapper.__init__(self, master)
		self.label = Tk.Label(self.super, labelCnf)
		self.label.pack(side=Tk.LEFT, fill=Tk.Y)
		Tk.Text.__init__(self, self.super, cnf)
		Tk.Text.pack(self, side=Tk.RIGHT, fill=Tk.BOTH, expand=Tk.TRUE)
예제 #13
0
    def __init__(self, master=None, cnf={}):
        cnf = _cnfmerge(cnf)
        fcnf = {}
        vcnf = {
            'name': 'vbar',
            Pack: {
                'side': 'right',
                'fill': 'y'
            },
        }
        for k in cnf.keys():
            if type(k) == ClassType or k == 'name':
                fcnf[k] = cnf[k]
                del cnf[k]
        self.frame = Frame(master, fcnf)
        self.vbar = Scrollbar(self.frame, vcnf)
        cnf[Pack] = {'side': 'left', 'fill': 'both', 'expand': 'yes'}
        cnf['name'] = 'text'
        Text.__init__(self, self.frame, cnf)
        self['yscrollcommand'] = (self.vbar, 'set')
        self.vbar['command'] = (self, 'yview')

        # Copy Pack methods of self.frame -- hack!
        for m in Pack.__dict__.keys():
            if m[0] != '_' and m != 'config':
                setattr(self, m, getattr(self.frame, m))
예제 #14
0
	def __init__(self, master=None, cnf=None, **kw):
		if cnf is None:
			cnf = {}
		if kw:
			from Tkinter import _cnfmerge
			cnf = _cnfmerge((cnf, kw))
		fcnf = {}
		for k in cnf.keys():
			if type(k) == ClassType or k == 'name':
				fcnf[k] = cnf[k]
				del cnf[k]
		self.frame = Frame(master, **fcnf)
		self.vbar = Scrollbar(self.frame, name='vbar')
		self.vbar.pack(side=RIGHT, fill=Y)
		cnf['name'] = 'lbox'
		Listbox.__init__(self, self.frame, **cnf)
		self.pack(side=LEFT, fill=BOTH, expand=1)
		self['yscrollcommand'] = self.vbar.set
		self.vbar['command'] = self.yview

		# Copy geometry methods of self.frame -- hack!
		methods = Pack.__dict__.keys()
		methods = methods + Grid.__dict__.keys()
		methods = methods + Place.__dict__.keys()

		for m in methods:
			if m[0] != '_' and m != 'config' and m != 'configure':
				setattr(self, m, getattr(self.frame, m))
예제 #15
0
    def _options(self, cnf, kw ):
	if kw and cnf:
	    cnf = _cnfmerge((cnf, kw))
	elif kw:
	    cnf = kw
	opts = ()
	for k, v in cnf.items():
	    opts = opts + ('-'+k, v)
	return opts
예제 #16
0
 def __init__(self, master = None, cnf = {}, **kw):
     cnf = _cnfmerge((cnf, kw))
     self.widgetName = '__dialog__'
     Widget._setup(self, master, cnf)
     self.num = self.tk.getint(self.tk.call('tk_dialog', self._w, cnf['title'], cnf['text'], cnf['bitmap'], cnf['default'], *cnf['strings']))
     try:
         Widget.destroy(self)
     except TclError:
         pass
예제 #17
0
 def __init__(self, master = None, cnf = {}, **kw):
     cnf = _cnfmerge((cnf, kw))
     self.widgetName = '__dialog__'
     Widget._setup(self, master, cnf)
     self.num = self.tk.getint(self.tk.call('tk_dialog', self._w, cnf['title'], cnf['text'], cnf['bitmap'], cnf['default'], *cnf['strings']))
     try:
         Widget.destroy(self)
     except TclError:
         pass
예제 #18
0
	def __init__(self, master=None, cnf={}, **kw):
		WidgetWrapper.__init__(self, master)
		scrollCnf, cnf = _splitCnf('scrollbar_', _cnfmerge((cnf, kw)))
		self.scroll = Tk.Scrollbar(self.super, scrollCnf)
		self.scroll.pack(fill=Tk.Y, side=Tk.LEFT)
		Tk.Text.__init__(self, self.super, cnf)
		Tk.Text.pack(self, fill=Tk.BOTH, expand=Tk.TRUE, side=Tk.RIGHT)
		self['yscrollcommand'] = self.scroll.set
		self.scroll['command'] = self.yview
예제 #19
0
 def __init__(self, master=None, cnf={}, **kw):
     WidgetWrapper.__init__(self, master)
     scrollCnf, cnf = _splitCnf('scrollbar_', _cnfmerge((cnf, kw)))
     self.scroll = Tk.Scrollbar(self.super, scrollCnf)
     self.scroll.pack(fill=Tk.Y, side=Tk.LEFT)
     Tk.Text.__init__(self, self.super, cnf)
     Tk.Text.pack(self, fill=Tk.BOTH, expand=Tk.TRUE, side=Tk.RIGHT)
     self['yscrollcommand'] = self.scroll.set
     self.scroll['command'] = self.yview
예제 #20
0
파일: Tix.py 프로젝트: Fyedka/mage
 def _options(self, cnf, kw):
     if kw and cnf:
         cnf = _cnfmerge((cnf, kw))
     elif kw:
         cnf = kw
     opts = ()
     for k, v in cnf.items():
         opts = opts + ('-' + k, v)
     return opts
예제 #21
0
    def __init__(self, master=None, cnf={}, **kw):
        Toplevel.__init__(self, master, class_="Dialog", **kw)
        self.transient(master)
        self.title(cnf["title"])
        self.iconname("Dialog")
        self.protocol("WM_DELETE_WINDOW", self.close)
        self.num = cnf["default"]

        cnf = _cnfmerge((cnf, kw))

        # Fill the top part with bitmap and message (use the option
        # database for -wraplength and -font so that they can be
        # overridden by the caller).
        #self.option_add("*Dialog.msg.wrapLength","3i","widgetDefault")
        #self.option_add("*Dialog.msg.font","TkCaptionFont","widgetDefault")

        fbot = Frame(self, relief=RAISED, bd=1)
        ftop = Frame(self, relief=RAISED, bd=1)
        fbot.pack(side=BOTTOM, fill=BOTH)
        ftop.pack(side=TOP, fill=BOTH, expand=YES)
        self.tk.call("grid", "anchor", fbot._w, CENTER)
        #self.grid_anchor(CENTER)

        l = Label(ftop,
                  text=cnf["text"],
                  wraplength="3i",
                  font="TkCaptionFont",
                  justify=LEFT)
        l.pack(side=RIGHT, fill=BOTH, expand=YES, padx="3m", pady="3m")

        if cnf["bitmap"]:
            l = Label(ftop, bitmap=cnf["bitmap"])
            l.pack(side=LEFT, padx="3m", pady="3m")

        # Create a row of buttons at the bottom of the dialog
        for i, s in enumerate(cnf["strings"]):
            b = Button(fbot, text=s, command=lambda s=self, n=i: s.close(n))
            b.bind("<Return>", lambda e: e.widget.invoke())
            if i == cnf["default"]:
                b.config(default="active")
                b.focus_set()
            else:
                b.config(default="normal")
            b.grid(column=i, row=0, sticky=EW, padx=10, pady=4)

        self.bind("<Escape>", lambda e, s=self: s.close())
        self.bind("<Right>", lambda e: e.widget.event_generate("<Tab>"))
        self.bind("<Left>", lambda e: e.widget.event_generate("<Shift-Tab>"))

        self.deiconify()
        self.wait_visibility()
        self.grab_set()
        self.focus_set()
        self.wait_window()
	def __init__(self, master=None, titled=Tk.FALSE, releaseCallback=None,
			cnf={}, **kw):
		self.releaseCallback = releaseCallback
		sbCnf, cnf = _splitCnf('scrollbar_', _cnfmerge((cnf, kw)))
		Tk.Frame.__init__(self, master, cnf, cursor='sb_h_double_arrow')
		self.scroll = Tk.Scrollbar(self, sbCnf, cursor='arrow',
					command=self.yview)
		self.scroll.pack(side=Tk.LEFT, fill=Tk.Y)
		self.sash = Sash(self, orient=Tk.HORIZONTAL)
		self.sash.pack(side=Tk.LEFT, fill=Tk.BOTH, expand=Tk.TRUE)
		self.listboxList = []
		self.titled = titled
예제 #23
0
    def pack(self, cnf = {}, **kw):
        if kw:
            cnf = _cnfmerge((cnf, kw))

        # Add frame to the canvas AFTER packing container frame
        # (to set width and height properly)
        self.container.pack(cnf)
        try:
            self.canvas.delete(self.canvas_frame_id)
        except AttributeError:
            pass
        self.canvas_frame_id = self.canvas.create_window(0, 0, window=self, anchor=NW)
예제 #24
0
	def __init__(self, master=None, cnf={}, **kw):
		labelCnf, cnf = _splitCnf('label_', _cnfmerge((cnf, kw)))
		WidgetWrapper.__init__(self, master)
		if len(labelCnf) > 0:
			title = Label(self.super, labelCnf)
			title.pack(side=Tk.TOP, fill=Tk.X)
		scrollCnf, cnf = _splitCnf('scrollbar_', cnf)
		self.scroll = Tk.Scrollbar(self.super, scrollCnf)
		self.scroll.pack(fill=Tk.Y, side=Tk.LEFT)
		Tk.Listbox.__init__(self, self.super, cnf)
		Tk.Listbox.pack(self, fill=Tk.BOTH, expand=Tk.TRUE, side=Tk.RIGHT)
		self['yscrollcommand'] = self.scroll.set
		self.scroll['command'] = self.yview
예제 #25
0
 def __init__(self, master=None, cnf={}, **kw):
     cnf = _cnfmerge((cnf, kw))
     self.widgetName = "__dialog__"
     Widget._setup(self, master, cnf)
     self.num = self.tk.getint(
         self.tk.call(
             "tk_dialog", self._w, cnf["title"], cnf["text"], cnf["bitmap"], cnf["default"], *cnf["strings"]
         )
     )
     try:
         Widget.destroy(self)
     except TclError:
         pass
예제 #26
0
 def __init__(self, master=None, cnf={}, **kw):
     labelCnf, cnf = _splitCnf('label_', _cnfmerge((cnf, kw)))
     WidgetWrapper.__init__(self, master)
     if len(labelCnf) > 0:
         title = Label(self.super, labelCnf)
         title.pack(side=Tk.TOP, fill=Tk.X)
     scrollCnf, cnf = _splitCnf('scrollbar_', cnf)
     self.scroll = Tk.Scrollbar(self.super, scrollCnf)
     self.scroll.pack(fill=Tk.Y, side=Tk.LEFT)
     Tk.Listbox.__init__(self, self.super, cnf)
     Tk.Listbox.pack(self, fill=Tk.BOTH, expand=Tk.TRUE, side=Tk.RIGHT)
     self['yscrollcommand'] = self.scroll.set
     self.scroll['command'] = self.yview
예제 #27
0
파일: tkDialogs.py 프로젝트: moacirbmn/bCNC
	def __init__(self, master=None, cnf={}, **kw):
		Toplevel.__init__(self, master, class_="Dialog", **kw)
		self.transient(master)
		self.title(cnf["title"])
		self.iconname("Dialog")
		self.protocol("WM_DELETE_WINDOW", self.close)
		self.num = cnf["default"]

		cnf = _cnfmerge((cnf, kw))

		# Fill the top part with bitmap and message (use the option
		# database for -wraplength and -font so that they can be
		# overridden by the caller).
		#self.option_add("*Dialog.msg.wrapLength","3i","widgetDefault")
		#self.option_add("*Dialog.msg.font","TkCaptionFont","widgetDefault")

		fbot = Frame(self, relief=RAISED, bd=1)
		ftop = Frame(self, relief=RAISED, bd=1)
		fbot.pack(side=BOTTOM, fill=BOTH)
		ftop.pack(side=TOP, fill=BOTH, expand=YES)
		self.tk.call("grid", "anchor", fbot._w, CENTER)
		#self.grid_anchor(CENTER)

		l = Label(ftop, text=cnf["text"], wraplength="3i", font="TkCaptionFont", justify=LEFT)
		l.pack(side=RIGHT, fill=BOTH, expand=YES, padx="3m", pady="3m")

		if cnf["bitmap"]:
			l = Label(ftop, bitmap=cnf["bitmap"])
			l.pack(side=LEFT, padx="3m", pady="3m")

		# Create a row of buttons at the bottom of the dialog
		for i,s in enumerate(cnf["strings"]):
			b = Button(fbot, text=s, command=lambda s=self,n=i:s.close(n))
			b.bind("<Return>", lambda e : e.widget.invoke())
			if i==cnf["default"]:
				b.config(default="active")
				b.focus_set()
			else:
				b.config(default="normal")
			b.grid(column=i, row=0, sticky=EW, padx=10, pady=4)

		self.bind("<Escape>", lambda e,s=self:s.close())
		self.bind("<Right>", lambda e : e.widget.event_generate("<Tab>"))
		self.bind("<Left>",  lambda e : e.widget.event_generate("<Shift-Tab>"))

		self.deiconify()
		self.wait_visibility()
		self.grab_set()
		self.focus_set()
		self.wait_window()
예제 #28
0
파일: Tix.py 프로젝트: Fyedka/mage
    def __init__(self,
                 master=None,
                 widgetName=None,
                 static_options=None,
                 cnf={},
                 kw={}):
        # Merge keywords and dictionary arguments
        if kw:
            cnf = _cnfmerge((cnf, kw))
        else:
            cnf = _cnfmerge(cnf)

        # Move static options into extra. static_options must be
        # a list of keywords (or None).
        extra = ()
        if static_options:
            for k, v in cnf.items()[:]:
                if k in static_options:
                    extra = extra + ('-' + k, v)
                    del cnf[k]

        self.widgetName = widgetName
        Widget._setup(self, master, cnf)

        # If widgetName is None, this is a dummy creation call where the
        # corresponding Tk widget has already been created by Tix
        if widgetName:
            apply(self.tk.call, (widgetName, self._w) + extra)

        # Non-static options - to be done via a 'config' command
        if cnf:
            Widget.config(self, cnf)

        # Dictionary to hold subwidget names for easier access. We can't
        # use the children list because the public Tix names may not be the
        # same as the pathname component
        self.subwidget_list = {}
예제 #29
0
    def pack(self, cnf={}, **kw):
        if kw:
            cnf = _cnfmerge((cnf, kw))

        # Add frame to the canvas AFTER packing container frame
        # (to set width and height properly)
        self.container.pack(cnf)
        try:
            self.canvas.delete(self.canvas_frame_id)
        except AttributeError:
            pass
        self.canvas_frame_id = self.canvas.create_window(0,
                                                         0,
                                                         window=self,
                                                         anchor=NW)
예제 #30
0
    def image_create(self, imgtype, cnf={}, master=None, **kw):
        if not master:
            master = Tkinter._default_root
            if not master:
                raise RuntimeError, 'Too early to create image'
        if kw and cnf:
            cnf = _cnfmerge((cnf, kw))
        elif kw:
            cnf = kw
        options = ()
        for k, v in cnf.items():
            if hasattr(v, '__call__'):
                v = self._register(v)
            options = options + ('-' + k, v)

        return master.tk.call(('image', 'create', imgtype) + options)
 def __init__(self,
              master=None,
              titled=Tk.FALSE,
              releaseCallback=None,
              cnf={},
              **kw):
     self.releaseCallback = releaseCallback
     sbCnf, cnf = _splitCnf('scrollbar_', _cnfmerge((cnf, kw)))
     Tk.Frame.__init__(self, master, cnf, cursor='sb_h_double_arrow')
     self.scroll = Tk.Scrollbar(self,
                                sbCnf,
                                cursor='arrow',
                                command=self.yview)
     self.scroll.pack(side=Tk.LEFT, fill=Tk.Y)
     self.sash = Sash(self, orient=Tk.HORIZONTAL)
     self.sash.pack(side=Tk.LEFT, fill=Tk.BOTH, expand=Tk.TRUE)
     self.listboxList = []
     self.titled = titled
예제 #32
0
    def __init__(self, master=None, cnf={}, **kw):
        WidgetWrapper.__init__(self, master)
        xscrollCnf, cnf = _splitCnf('xscrollbar_', _cnfmerge((cnf, kw)))
        yscrollCnf, cnf = _splitCnf('yscrollbar_', cnf)
        self._xscroll = Tk.Scrollbar(self.super,
                                     xscrollCnf,
                                     orient=Tk.HORIZONTAL,
                                     command=self.xview)
        self._yscroll = Tk.Scrollbar(self.super,
                                     yscrollCnf,
                                     command=self.yview)
        Tk.Text.__init__(self,
                         self.super,
                         cnf,
                         wrap=Tk.NONE,
                         xscrollcommand=self._xscroll.set,
                         yscrollcommand=self._yscroll.set)
        self._numLines = 0
        self._maxLineLen = 0
        import tkFont
        fontname = self.cget('font')
        font = tkFont.Font(self, fontname)
        self._linespace = font.metrics('linespace')
        self._charwidth = font.measure('0')
        self._offset = int(self.cget('borderwidth')) \
           + int(self.cget('padx')) \
           + int(self.cget('selectborderwidth')) \
           + int(self.cget('highlightthickness'))
        self._offset *= 2  # both sides
        self._inShow = False
        self.bind('<<Modified>>', self._modified)
        self.bind('<Configure>', self._showScrollbars)

        # Set horizontal scroll bar to be the same height as one line
        # so only whole lines are visible.  Set the width of the
        # vertical scroll bar the same for consistency.
        barSize = self._linespace - 2 * (int(self._xscroll.cget(
            'borderwidth')) + int(self._xscroll.cget('highlightthickness')))
        self._xscroll.configure(width=barSize)
        self._yscroll.configure(width=barSize)
        self.super.grid_rowconfigure(0, weight=1)
        self.super.grid_columnconfigure(0, weight=1)

        Tk.Text.grid(self, row=0, column=0, sticky='nesw')
예제 #33
0
 def __init__(self, master=None, orient=Tk.VERTICAL, cnf={}, **kw):
     if orient == Tk.VERTICAL:
         self.orientation = Tk.VERTICAL
     elif orient == Tk.HORIZONTAL:
         self.orientation = Tk.HORIZONTAL
     else:
         raise ValueError, 'unknown orientation'
     if self.orientation is Tk.VERTICAL:
         self._buttonDrag = self._buttonDragVertical
         cursor = 'sb_v_double_arrow'
     else:
         self._buttonDrag = self._buttonDragHorizontal
         cursor = 'sb_h_double_arrow'
     cnf = _cnfmerge((cnf, kw))
     Tk.Frame.__init__(self, master, cnf, cursor=cursor)
     self.needResize = self.master is self.winfo_toplevel()
     self.paneList = []
     self.bind('<Configure>', self._computeSize)
     self.bind('<ButtonPress-1>', self._buttonPress)
     self.bind('<ButtonRelease-1>', self._buttonRelease)
예제 #34
0
	def __init__(self, master=None, orient=Tk.VERTICAL, cnf={}, **kw):
		if orient == Tk.VERTICAL:
			self.orientation = Tk.VERTICAL
		elif orient == Tk.HORIZONTAL:
			self.orientation = Tk.HORIZONTAL
		else:
			raise ValueError, 'unknown orientation'
		if self.orientation is Tk.VERTICAL:
			self._buttonDrag = self._buttonDragVertical
			cursor = 'sb_v_double_arrow'
		else:
			self._buttonDrag = self._buttonDragHorizontal
			cursor = 'sb_h_double_arrow'
		cnf = _cnfmerge((cnf, kw))
		Tk.Frame.__init__(self, master, cnf, cursor=cursor)
		self.needResize = self.master is self.winfo_toplevel()
		self.paneList = []
		self.bind('<Configure>', self._computeSize)
		self.bind('<ButtonPress-1>', self._buttonPress)
		self.bind('<ButtonRelease-1>', self._buttonRelease)
 def __init__(self, master=None, cnf={}, **kw):
     sbCnf, cnf = _splitCnf('scrollbar_', _cnfmerge((cnf, kw)))
     textCnf, cnf = _splitCnf('text_', cnf)
     Tk.Frame.__init__(self, master, cnf)
     self.scroll = Tk.Scrollbar(self, sbCnf)
     self.scroll.pack(side=Tk.LEFT, fill=Tk.Y)
     self.text = Tk.Text(self, textCnf)
     self.text.pack(side=Tk.LEFT, expand=Tk.YES, fill=Tk.BOTH)
     self.scroll['command'] = self.text.yview
     self.text['yscrollcommand'] = self.scroll.set
     self.text['state'] = Tk.DISABLED
     self.text.bind('<ButtonPress-1>', self._buttonPress)
     self.text.bind('<ButtonRelease-1>', self._buttonRelease)
     self.text.bind('<B1-Motion>', self._buttonMotion)
     self.text.bind('<Double-ButtonRelease-1>', self._buttonDoubleLeft)
     self.text.bind('<Double-ButtonRelease-2>', self._buttonDoubleRight)
     self._lastSelected = None
     self._tagDict = {}
     self._entry = Entry('ROOT', isLeaf=Tk.NO)
     self._entry.show(self, '0.0')
예제 #36
0
    def __init__(self, master=None, cnf={}, **kw):
        if kw:
            cnf = _cnfmerge((cnf, kw))
        fcnf = {}
        for k in cnf.keys():
            if type(k) == ClassType or k == 'name':
                fcnf[k] = cnf[k]
                del cnf[k]
        self.frame = apply(Frame, (master, ), fcnf)
        self.vbar = Scrollbar(self.frame, name='vbar')
        self.vbar.pack(side=RIGHT, fill=Y)
        cnf['name'] = 'text'
        apply(Text.__init__, (self, self.frame), cnf)
        self.pack(side=LEFT, fill=BOTH, expand=1)
        self['yscrollcommand'] = self.vbar.set
        self.vbar['command'] = self.yview

        # Copy Pack methods of self.frame -- hack!
        for m in Pack.__dict__.keys():
            if m[0] != '_' and m != 'config' and m != 'configure':
                setattr(self, m, getattr(self.frame, m))
예제 #37
0
	def __init__(self, master=None, cnf={}, **kw):
		WidgetWrapper.__init__(self, master)
		xscrollCnf, cnf = _splitCnf('xscrollbar_', _cnfmerge((cnf, kw)))
		yscrollCnf, cnf = _splitCnf('yscrollbar_', cnf)
		self._xscroll = Tk.Scrollbar(self.super, xscrollCnf,
				orient=Tk.HORIZONTAL, command=self.xview)
		self._yscroll = Tk.Scrollbar(self.super, yscrollCnf,
							command=self.yview)
		Tk.Text.__init__(self, self.super, cnf, wrap=Tk.NONE,
				xscrollcommand=self._xset,
				yscrollcommand=self._yset)
		self._hasXScroll = False
		self._hasYScroll = False
		self._skipReset = False
		self.bind('<Configure>', self._reset)
		#self.bind('<<Modified>>', self._monitor)

		self.super.grid_rowconfigure(0, weight=1)
		self.super.grid_columnconfigure(0, weight=1)

		Tk.Text.grid(self, row=0, column=0, sticky='nesw')
예제 #38
0
    def __init__(self, master=None, cnf={}):
        cnf = _cnfmerge(cnf)
        fcnf = {}
        vcnf = {'name': 'vbar',
            Pack: {'side': 'right', 'fill': 'y'},}
        for k in cnf.keys():
            if type(k) == ClassType or k == 'name':
                fcnf[k] = cnf[k]
                del cnf[k]
        self.frame = Frame(master, fcnf)
        self.vbar = Scrollbar(self.frame, vcnf)
        cnf[Pack] = {'side': 'left', 'fill': 'both', 'expand': 'yes'}
        cnf['name'] = 'list'
        Listbox.__init__(self, self.frame, cnf)
        self['yscrollcommand'] = (self.vbar, 'set')
        self.vbar['command'] = (self, 'yview')

        # Copy Pack methods of self.frame -- hack!
        for m in Pack.__dict__.keys():
            if m[0] != '_' and m != 'config':
                setattr(self, m, getattr(self.frame, m))
예제 #39
0
	def __init__(self, master=None, cnf={}, **kw):
		if kw:
			cnf = _cnfmerge((cnf, kw))
		fcnf = {}
		for k in cnf.keys():
			if type(k) == ClassType or k == 'name':
				fcnf[k] = cnf[k]
				del cnf[k]
		self.frame = apply(Frame, (master,), fcnf)
		self.vbar = Scrollbar(self.frame, name='vbar')
		self.vbar.pack(side=RIGHT, fill=Y)
		cnf['name'] = 'text'
		apply(Text.__init__, (self, self.frame), cnf)
		self.pack(side=LEFT, fill=BOTH, expand=1)
		self['yscrollcommand'] = self.vbar.set
		self.vbar['command'] = self.yview

		# Copy Pack methods of self.frame -- hack!
		for m in Pack.__dict__.keys():
			if m[0] != '_' and m != 'config' and m != 'configure':
				setattr(self, m, getattr(self.frame, m))
예제 #40
0
	def __init__(self, master=None, cnf={}, **kw):
		WidgetWrapper.__init__(self, master)
		xscrollCnf, cnf = _splitCnf('xscrollbar_', _cnfmerge((cnf, kw)))
		yscrollCnf, cnf = _splitCnf('yscrollbar_', cnf)
		self._xscroll = Tk.Scrollbar(self.super, xscrollCnf,
				orient=Tk.HORIZONTAL, command=self.xview)
		self._yscroll = Tk.Scrollbar(self.super, yscrollCnf,
							command=self.yview)
		Tk.Text.__init__(self, self.super, cnf, wrap=Tk.NONE,
				xscrollcommand=self._xscroll.set,
				yscrollcommand=self._yscroll.set)
		self._numLines = 0
		self._maxLineLen = 0
		import tkFont
		fontname = self.cget('font')
		font = tkFont.Font(self, fontname)
		self._linespace = font.metrics('linespace')
		self._charwidth = font.measure('0')
		self._offset = int(self.cget('borderwidth')) \
					+ int(self.cget('padx')) \
					+ int(self.cget('selectborderwidth')) \
					+ int(self.cget('highlightthickness'))
		self._offset *= 2 # both sides
		self._inShow = False
		self.bind('<<Modified>>', self._modified)
		self.bind('<Configure>', self._showScrollbars)

		# Set horizontal scroll bar to be the same height as one line
		# so only whole lines are visible.  Set the width of the
		# vertical scroll bar the same for consistency.
		barSize = self._linespace - 2 * (
				int(self._xscroll.cget('borderwidth'))
				+ int(self._xscroll.cget('highlightthickness')))
		self._xscroll.configure(width=barSize)
		self._yscroll.configure(width=barSize)
		self.super.grid_rowconfigure(0, weight=1)
		self.super.grid_columnconfigure(0, weight=1)

		Tk.Text.grid(self, row=0, column=0, sticky='nesw')
예제 #41
0
	def __init__(self, master=None, cnf={}, **kw):
		sbCnf, cnf = _splitCnf('scrollbar_', _cnfmerge((cnf, kw)))
		textCnf, cnf = _splitCnf('text_', cnf)
		Tk.Frame.__init__(self, master, cnf)
		self.scroll = Tk.Scrollbar(self, sbCnf)
		self.scroll.pack(side=Tk.LEFT, fill=Tk.Y)
		self.text = Tk.Text(self, textCnf)
		self.text.pack(side=Tk.LEFT, expand=Tk.YES, fill=Tk.BOTH)
		self.scroll['command'] = self.text.yview
		self.text['yscrollcommand'] = self.scroll.set
		self.text['state'] = Tk.DISABLED
		self.text.bind('<ButtonPress-1>', self._buttonPress)
		self.text.bind('<ButtonRelease-1>', self._buttonRelease)
		self.text.bind('<B1-Motion>', self._buttonMotion)
		self.text.bind('<Double-ButtonRelease-1>',
				self._buttonDoubleLeft)
		self.text.bind('<Double-ButtonRelease-2>',
				self._buttonDoubleRight)
		self._lastSelected = None
		self._tagDict = {}
		self._entry = Entry('ROOT', isLeaf=Tk.NO)
		self._entry.show(self, '0.0')
예제 #42
0
 def unbind(self, cnf = {}, **kw):
     if kw:
         cnf = _cnfmerge((cnf, kw))
     self.container.unbind(cnf)
예제 #43
0
# A ScrolledText widget feels like a text widget but also has a
예제 #44
0
 def config(self, cnf={}, **kw):
     return self.canvas.itemconfig(self.id, _cnfmerge((cnf, kw)))
예제 #45
0
 def unbind(self, cnf={}, **kw):
     if kw:
         cnf = _cnfmerge((cnf, kw))
     self.container.unbind(cnf)
예제 #46
0
파일: Canvas.py 프로젝트: msegeya/fbroute
 def config(self, cnf={}, **kw):
     return self.canvas.itemconfig(self.id, _cnfmerge((cnf, kw)))
예제 #47
0
# A ScrolledList widget feels like a list widget but also has a
예제 #48
0
# Dialog.py -- Tkinter interface to the tk_dialog script.
예제 #49
0
파일: Canvas.py 프로젝트: mcyril/ravel-ftn
# This module exports classes for the various canvas item types
예제 #50
0
파일: Dialog.py 프로젝트: mcyril/ravel-ftn
# Dialog.py -- Tkinter interface to the tk_dialog script.
예제 #51
0
# A ScrolledList widget feels like a list widget but also has a
예제 #52
0
# A ScrolledText widget feels like a text widget but also has a