Toplevel with no border stays on top - tk-toolkit

If i create a toplevel without border, the toplevel stays always on top of the desktop:
toplevel .t -bg red ; wm overrideredirect .t 1
That means, if i drag another application "over" the toplevel, it hides behind the toplevel.
Im trying to reimplement "::tk::MessageBox" but without a decorated toplevel.
Is there another way to get rid of the "border-decoration" without using "overrideredirect"?
Runing on linux / tk8.6.11
Thanks for any hints,
Matthias

Related

How to get window decorations pixel size in LUA

I am using rdesktop with seamlessrdp. This way I can open Windows apps on my Linux machines. Also I added devilspie2 to the mix so I could control the window decorations. devilspie2 uses lua as its config management. I made everything work. The only issue left is to move the opening (dialog) windows a couple of pixels because the VNC windows will appear as if they had decorations (but without them). I got the code working by hard coding the amount of pixels needed to move. The issue is we have more than one distros here and they have different pixel sizes for their window decorations.
What I want is to GET the decoration size in pixels instead of hard coding them so it will work perfectly for all my distros.
Here is the piece of code that does it atm:
if get_window_class()=="SeamlessRDP" then
undecorate_window();
--x-1 and y-28 works for one distro but for the other I need to use x-6 and y-27
if get_window_type()=="WINDOW_TYPE_DIALOG" then
x, y = xy();
xy(x-1, y-28);
end
end
As you can see from the script. It would be much better if I could somehow call the size of the window decorations and then use them rather than hard coded pixels.
EDIT (ANSWER):
Even though I found the answer before the following post, I wanted to accept it anyways because it did show the right path to follow. I am only further commenting here to show the full answer:
--get x and y's for decorated and non-decorated windows
x1, y1, width1, height1 = get_window_geometry();
x2, y2, width2, height2 = get_window_client_geometry();
--calculate pixels to slide window
xpixel = x2-x1;
ypixel = y2-y1;
--check if class is seamlessrdp
if get_window_class()=="SeamlessRDP" then
undecorate_window();
--if window is a dialog then move it
if get_window_type()=="WINDOW_TYPE_DIALOG" then
xy(x1-xpixel, y1-ypixel);
end
end
devilspie2 provides only two ways to get the window size, get_window_geometry and get_window_client_geometry.
Whereby the last one excludes the window borders. If this does not work for you, you can create a file with a table for all values to make them easily editable. You could also use the window class names as table keys if possible to make the use easier.

Putting a bar above an argument so that they touch

I would like to put a line/bar over an argument, so that the bar just touches the top of the highest point of the argument. I do not want any gap between the bar and argument. Basically, I would like to create a command \justtouching{A} which resembles \r{A}, but with a line instead of a small circle right above the A.
My initial thought was to try and lower the \overline{argument} command so that it just touches the top of the 'argument', but I couldn't quite figure out how to do this.
I don't necessarily need the command to be operable only in the math environment -- manipulating the \overline command was just an idea that I thought would be the easiest to implement.
Any ideas/input would be greatly appreciated. Thanks!

Using Printer Control Language (PCL) to Increase Left Margin

We have a very old program that we print from where you are unable to change the left print margin in the program. I need to get it printing further from the left edge, ideally about 1 inch for binding. No issue with text going over the right edge as it doesn't get near that side of the page.
My idea was to use a custom separator page https://support.microsoft.com/en-us/kb/131714 to issue a PCL command to increase the left margin.
We are using HP printers and I have tried using the standard windows example C:\Windows\System32\pcl.sep which works exactly as expected.
This is my attempt at a .sep file (am saving in the system32 folder)
\
\H1B\L%-12345X
\H1B\LE
\H1B\L&l4000U
\H1B\L&a+3000H
\
I've tried a couple of variations, but it does absolutely nothing, my document just prints like normal.
Any help much appreciated.
My guess is that the application is explicitly setting the margins,
thus undoing anything you are trying in the .sep file. I am not familiar with the .sep file at all.
In the PCL context, if you are printing in duplex you want the extra binding on the left for the front side and on the right for the backside. The PCL command to end up with a 1 inch binding margin would be something like &l540U The 540U shifts the image 3/4 inch which when added to the existing minimum 1/4 inch margin gives you a 1 inch total.
Can you direct your output to a file to see what is actually being sent to the printer?

How insert some space before and after images in Sphinx

I created a document via Sphinx with the make latexpdf command.
Now I have the problem that LaTeX is setting my picture at the top directly after the text and at the bottom of the image it puts 3 or 4 linebreaks.
Is there a possibility to get 1 space at the top and 1 space at the bottom of the picture without
having to use a \ in the syntax?
My code:
title:
===========
some text
.. image:: screenshots/manage_products.png
some more text
another title:
===========
EDIT: Here a little Screenshot to show you my problem. I also looked into the main documentation of Sphinx (+ Syntax documentation) and found no answer for this problem!
Btw: Ignore the red arrow plz.
You could use the .. figure:: directive to add the extra spacing you would like around your image.
title:
===========
some text
.. figure:: screenshots/manage_products.png
some more text
I like using the figure directive more as well, since you have some additional control elements to your image, such as labeling.
.. figure::
Your figure text here
Wanted to add a narrow line after the image and tried all sorts of combinations and all either did not work or gave a wide line after the image.
Ended up creating a tiny empty.png image and inserted into the page with the following:
.. image:: _static/main.png
:align: center
:scale: 70 %
.. image:: _static/empty.png
.. empty.png image above to add space after main.png image

Is there an easy way to cut a slice from an image using Gimp?

Wondering if there is an easy way to remove a rectangular slice across the entire width of an image using Gimp, and have the resulting hole closed up automatically. I hope that makes sense. If I select a slice across an image and do "cut", it leaves a blank "hole" there. I want the new top and bottom of the image to join and fill that hole, reducing the image height by the amount sliced out.
Any easy way to do this?
Here is a method that is quick and often does what you want:
Cut out the middle, leaving a transparent "hole".
Click anywhere to remove the selection (so the hole is not selected).
Click Image > Zealous crop .
This is going to remove the middle part. However, if you also have transparency in other parts of the image (like around the edges) it's going to remove that transparency too.
I believe you're asking to do something like cut out the middle of a page, leaving the header and footer and have the blank space removed with the cut action, effectively joining the header and footer together.
To my knowledge, I don't believe so. Even if you cut, or delete, that space is still part of the image even without content.
But, you would be able to highlight the top or bottom (or left or right) of the remaining space and drag it to align with the other side. It's not ideal for repetitive tasks, but should get you through if you only have to do it a few times.
Install Python and the Python Imaging Library. Back in GIMP, select and cut the full-width areas you don't want to transparent, and export the image to test.png. Then use this Python code (works only if complete lines are transparent; will not work properly if there are 100%-transparent pixels anywhere other than on a full-width row)—
from PIL import Image
i = Image.open("test.png")
b = i.tobytes()
b2 = ''.join(b[n:n+4] for n in xrange(0,len(b),4) if ord(b[n+3]))
newHeight = len(b2)/i.width/4
i2 = Image.frombytes('RGBA',(i.width,newHeight),b2)
i2.save("test.png")
Then re-load test.png and verify that the areas you cut have gone.
In gimp 2.8.1 you can easily create a new image from a selection. So if you select a rectangular than do a copy (Ctrl-C) and a past in a new image
Edit -> Paste as -> new image (or Ctrl-Shift-V).

Resources