I've written a simple Tk-based GUI using Ruby and, so far, I've been
able to work out how to do everything I need by reading Tcl and perl
Tk documentation or from searches on Google.

However, I've now hit a bit of a brick wall.  I have a situation where
I want to pop up a data entry window at the current cursor location,
to allow the user to enter a label to associate with an item on the
screen.

Can someone point me at an example of code that does this in any
language at all?

I know there are pop-up dialogs that contain just buttons, for
confirmation of actions and so on, but can't work out how to create an
arbitrary secondary window of my own design.

I could just make the data entry field part of the window proper, but
that would mean it's there all the time, rarther than just when needed
and it would also disassociate the data entry field from the specific
item that is being addressed.

This seems like such a fundamental thing that it must be done all the
time, but as I say I haven't been able to find an example anywhere.

Note that while I would like to be able to specify the position where
the window pops up (so I can place it near the cursor), just being
able to do it at all would be a start.