Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17230 > unrolled thread

What is this widget?

Started byMuddy Coder <cosmo_general@yahoo.com>
First post2011-12-14 10:47 -0800
Last post2011-12-15 07:33 -0800
Articles 5 — 5 participants

Back to article view | Back to comp.lang.python


Contents

  What is this widget? Muddy Coder <cosmo_general@yahoo.com> - 2011-12-14 10:47 -0800
    Re: What is this widget? Dave Angel <d@davea.name> - 2011-12-14 14:48 -0500
    Re: What is this widget? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-12-14 14:54 -0500
    Re: What is this widget? Terry Reedy <tjreedy@udel.edu> - 2011-12-14 18:23 -0500
    Re: What is this widget? Rick Johnson <rantingrickjohnson@gmail.com> - 2011-12-15 07:33 -0800

#17230 — What is this widget?

FromMuddy Coder <cosmo_general@yahoo.com>
Date2011-12-14 10:47 -0800
SubjectWhat is this widget?
Message-ID<d69ec70b-45aa-41b1-81e9-9d15f116c1df@o9g2000yqa.googlegroups.com>
Hi Folks,

I am trying to write letters on a photo that is opened in a canvas. So
I think I must need a widget to contain the letters I will type in. I
tried to use a Label, it worked. But, a Label covered part of the
photo underneath, so I can't use it. I saw some software did such a
thing nicely: a box popped on a photo, with dotted lines as borders,
expandable. When such a box was re-sized with a mouse, the font size
in the box also got changed. The box has no background color, so it
does not cover a rectangle area on the photo. I need such a widget,
but I don't know what is this one. I tried Text, Label, but they all
come with Window-like stuff, so they cover some photo content. Can
somebody points me a direction? Thanks!


Cosmo

[toc] | [next] | [standalone]


#17232

FromDave Angel <d@davea.name>
Date2011-12-14 14:48 -0500
Message-ID<mailman.3654.1323892141.27778.python-list@python.org>
In reply to#17230
On 12/14/2011 01:47 PM, Muddy Coder wrote:
> Hi Folks,
>
> I am trying to write letters on a photo that is opened in a canvas. So
> I think I must need a widget to contain the letters I will type in. I
> tried to use a Label, it worked. But, a Label covered part of the
> photo underneath, so I can't use it. I saw some software did such a
> thing nicely: a box popped on a photo, with dotted lines as borders,
> expandable. When such a box was re-sized with a mouse, the font size
> in the box also got changed. The box has no background color, so it
> does not cover a rectangle area on the photo. I need such a widget,
> but I don't know what is this one. I tried Text, Label, but they all
> come with Window-like stuff, so they cover some photo content. Can
> somebody points me a direction? Thanks!
>
>
> Cosmo
I don't have an answer, but it'd be much easier for others if you 
specified what gui toolkit you're using, and probably also the OS and 
Python versions.


-- 

DaveA

[toc] | [prev] | [next] | [standalone]


#17233

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2011-12-14 14:54 -0500
Message-ID<mailman.3655.1323892507.27778.python-list@python.org>
In reply to#17230
On Wed, 14 Dec 2011 10:47:24 -0800 (PST), Muddy Coder
<cosmo_general@yahoo.com> wrote:

>I am trying to write letters on a photo that is opened in a canvas. So
>I think I must need a widget to contain the letters I will type in. I
>tried to use a Label, it worked. But, a Label covered part of the
>photo underneath, so I can't use it. I saw some software did such a
>thing nicely: a box popped on a photo, with dotted lines as borders,
>expandable. When such a box was re-sized with a mouse, the font size
>in the box also got changed. The box has no background color, so it
>does not cover a rectangle area on the photo. I need such a widget,
>but I don't know what is this one. I tried Text, Label, but they all
>come with Window-like stuff, so they cover some photo content. Can
>somebody points me a direction? Thanks!

	You haven't specified which toolkit you are using: Tk, wx, GTK,
win32 native... So I'm going to go down to the root basics.

	The "widget" would be the entire image canvas, you have to intercept
each key stroke and mouse operation (to control the dotted box size),
and render the text via a combination of first blitting the photo to the
canvas and then drawing the dotted box and text over the rendered photo.

	With advanced coding you could keep track of the dotted border and
only blit that part of the photo onto the visible canvas each time you
update the box contents.

	Maybe some toolkit has a native way to do this, but it would have to
be a totally transparent widget except for the dot outline, dynamically
positioned over the photo canvas.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#17241

FromTerry Reedy <tjreedy@udel.edu>
Date2011-12-14 18:23 -0500
Message-ID<mailman.3660.1323905042.27778.python-list@python.org>
In reply to#17230
On 12/14/2011 1:47 PM, Muddy Coder wrote:
> Hi Folks,
>
> I am trying to write letters on a photo that is opened in a canvas. So
> I think I must need a widget to contain the letters I will type in. I
> tried to use a Label, it worked. But, a Label covered part of the
> photo underneath, so I can't use it.

You could use a entry widget over or outside the canvas for the user to 
enter the text, and then close that box and write the entered text to 
the canvas. Whether you can make the background of the entry box 
transparent probably depends on the gui toolkit.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#17275

FromRick Johnson <rantingrickjohnson@gmail.com>
Date2011-12-15 07:33 -0800
Message-ID<0c31c34c-e446-420e-8aa8-f5313612463f@g41g2000yqa.googlegroups.com>
In reply to#17230
On Dec 14, 12:47 pm, Muddy Coder <cosmo_gene...@yahoo.com> wrote:
> Hi Folks,
>
> I am trying to write letters on a photo that is opened in a canvas. So
> I think I must need a widget to contain the letters I will type in. I
> tried to use a Label, it worked. But, a Label covered part of the
> photo underneath, so I can't use it. I saw some software did such a
> thing nicely: a box popped on a photo, with dotted lines as borders,
> expandable. When such a box was re-sized with a mouse, the font size
> in the box also got changed. The box has no background color, so it
> does not cover a rectangle area on the photo. I need such a widget,
> but I don't know what is this one. I tried Text, Label, but they all
> come with Window-like stuff, so they cover some photo content. Can
> somebody points me a direction? Thanks!

Listen Muddy, this is not first time that you've come here seeking
advice with a cryptic and ambiguous post. People have been very
patient and even asked you to be more explicit with your questions. I
highly advise you to re-write your original post and include which GUI
library you are using and any other pertinent info.

My guess is that you are using Tkinter. If so, i believe the canvas
has a method called "create_text" which will do what you want. To make
the input easier to code, use a Tkinter Entry widget stuffed into a
dialog -- tkSimpleDialog makes this, well, simple.

PS: Clean up you act Muddy!

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web