Re: Tkinter: Clipping a canvas text item

From: robin bryce (robin_at_wiretooth.com)
Date: 02/21/04


Date: Sat, 21 Feb 2004 16:35:23 +0000
To: python-list@python.org

oops. wrong thread. apologies.

On Sat, 2004-02-21 at 13:19, Peter Otten wrote:
> Is there a way to limit both width and height of a canvas text item?
> My current workaround seems clumsy:
>
> import Tkinter as tk
> root = tk.Tk()
> canvas = tk.Canvas(root, width=400, height=200, bg="white")
> canvas.pack()
>
> # simulate a clipped text item - never transparent :-(
> s = "The long and winding road.."
> lbl = tk.Label(root, text=s, anchor=tk.W, bg=canvas["bg"])
> canvas.create_window(50, 80, width=100, height=20,
> window=lbl,
> anchor=tk.NW)
>
> root.mainloop()
>
> Thanks,
> Peter



Relevant Pages

  • Re: Tkinter: Clipping a canvas text item
    ... > Is there a way to limit both width and height of a canvas text item? ... > My current workaround seems clumsy: ... > import Tkinter as tk ...
    (comp.lang.python)
  • Re: DuChamp
    ... > Apologies if this story has already been posted. ... > Some poor deranged person is always slashing some ... > canvas somewhere, or spraying graffiti over areas ...
    (rec.arts.fine)
  • DuChamp
    ... Apologies if this story has already been posted. ... Some poor deranged person is always slashing some ... canvas somewhere, or spraying graffiti over areas ...
    (rec.arts.fine)
  • Re: Horizontal Scroll for CheckListBox
    ... In article, Marco Monti wrote: ... > My apologies... ... it does not measure the listbox strings. ... way (code is assumed to sit in a form method, so canvas is the forms ...
    (borland.public.delphi.language.objectpascal)
  • Re: More Toolbars ...
    ... Thanks for responding and apologies for this late reply, havent been around in a while ... I will furhter try to get some workaround about this, nonetheless i appreciate your suggestion, ...
    (microsoft.public.windows.inetexplorer.ie6.browser)