×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Moving objects in a TK window

Moving objects in a TK window

Moving objects in a TK window

(OP)
I use vtcl V1.6.0.a3 to create some TK windows.
I notice that when moving objects they move behind some other objects but move above some other objects.
Is there a way to specify for an object to move above or below some other object?

RE: Moving objects in a TK window

What exactly do you mean by object? Are these shapes drawn on a canvas or widgets?

RE: Moving objects in a TK window

(OP)
By objects I mean Labels, Entry boxes or any widget. Another solution for what I would want is to be able to make the background of a widget transparent. I don't see an option for this. Is there a work around to make a widget background transparent?

RE: Moving objects in a TK window

Do these objects move dynamically under program control? Is it animated? Do you have a simple example like 2 buttons moving around the screen or have I not understood what you are trying to achieve?

Re: transparent backgrounds - not officially supported because X11 does not support it. Having said that, there is this example on the internet in python https://stackoverflow.com/questions/53021603/how-t...

RE: Moving objects in a TK window

(OP)
OK, I have an example.
Sorry, I should have included this originally.
I use vtcl with the place manager to generate the graphic parts of a window. Once positioned, there they stay. They do not move while running the program.
In the example the 'Lasts' label is sitting on top of the 'Charge' label and the 'Refresh' button. What I would like to do is place the 'Lasts' label underneath the other 2 widgets.

RE: Moving objects in a TK window

(OP)
I think I have worked out how vtcl places one widget over on top of others.
It appears that at the time of widget creation any widget created after any other widget will be on top of those widgets. So, it is purely which widget is created after any other widget to be on top.

To move a widget above another widget, in the program, just move the lines that create the widget after the other widgets. It is a pain to get into the code when using vtcl because the purpose of vtcl is to be able to create the widgets and positions and other options without getting into the code. But, I guess it can't do everything.

I would still like to be able to make the background of a widget transparent. If there is anyone out there who knows how to do that, it would be great.

RE: Moving objects in a TK window

Instead of using absolute positioning, why not just use a grid layout. Then you can just use row and column positions instead of trying to work out how big each widget is.

The widgets can span several rows/columns so you can end up with all sorts. This is a lot easier to work out if you draw it out before coding it.

RE: Moving objects in a TK window

(OP)
I understand that but I am used to the place manager and I like to place widgets where I want them.

You did show a link where moving widgets while running the program was possible. I must admit I didn't follow the code in that example. However it's not while running the program I want to make the background transparent but while coding or moving the widget to place them where I want them initially.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close