Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving objects in a TK window

Status
Not open for further replies.

fhutt

Programmer
Jul 7, 2006
79
AU
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?
 
What exactly do you mean by object? Are these shapes drawn on a canvas or widgets?
 
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?
 
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
 
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.
 
 https://files.engineering.com/getfile.aspx?folder=cac7a00c-1a45-4783-a6f6-a41cef73f3e5&file=background.png
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.
 
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.
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top