So I just want a very simple transparent background for my GUI, the only purpose of this is just to have some fun with my brother like basically putting an invisible wall between the pc and him, no apps or anything like that, this is my current code-
!Z::
Gui, -Border -Caption +AlwaysOnTop
Gui, color , black ; Alt + Z
Gui, Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%
Return
!X::
Gui, destroy ; Alt + X
Return
Now all I want to do is make the GUI transparent instead of black
I'm not too familiar with code or anything and am very new
I've googled around but wasn't able to understand how to do it
Please help
Thanks In Advance
!Z::
Gui, -Border -Caption +AlwaysOnTop
Gui, color , black ; Alt + Z
Gui, Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%, barrier
WinSet, Transparent, 0, barrier
Return
!X::
Gui, destroy ; Alt + X
Return
Related
So I'm new to AHK and I googled a lot before landing here, but I can't find anything that answers my question. I want to make a script that only moves the Y axis from the mouse but relative to the position of the mouse. For example if the center of my screen is 683,384 and my mouse is at 630, and 389, and I want that the X axis stays but the Y axis goes back where the middle should be
Here's what I mean drawn in paint.. Red is the center black are the X and Y axis yellow is the mouse and blue the desired movement
and if it's always the same spot it would be easy, but I want it to be able to go to the center(relative to the mouse) no matter if its more up or more down that shown in the picture if you know any solutions please help me. Thank you for taking your time reading this
Super easy to do with MouseGetPos(docs) and MouseMove(docs).
First get the current X coordinate, and then move the cursor to that X coordinate along with an Y coordinate that's half of the screen height.(A_ScreenHeight(docs) can be used)
Also remember to specify the desired CoordMode, which is this case is going to be Screen, as opposed to the default which would be the active window.
Example for F1 as the hotkey.
CoordMode, Mouse, Screen
F1::
MouseGetPos, X
MouseMove, % X, % A_ScreenHeight / 2, 0
return
Who do I apply a white background for the colorbar tick labels? (I use a jet colormap in which black text is hardly visual - changing the text color to white doesn't help either)
A typical workaround for text such as:
h = text(0.1,0.1,'some text','units','normalized','color','k','background','w');
isn't working; seems that background doesn't apply for colorbar.
One of the things I could think of is to set the figure background to white, so everything is seen better.
figure('Color',[1 1 1]);
[c, h] = contour(peaks/30);
clabel(c, h)
cb = colorbar
As you know in MATLAB R2014a compiler we can set a picture to open in center of screen before opening of main GUI (loading process). How can I have this functionality without using compiler (in MATLAB environment) - open a picture without any frame (only picture) in center of screen for a specific time (for example 2~3 second) and after that automatically the main GUI will open.
Thanks.
Here is sample code to demonstrate how to do it:
clear
clc
iptsetpref('ImshowBorder','tight'); % Tell Matlab not to show borders
ScreenSize = get(0,'ScreenSize') % Get the screen size, in the form [left bottom width height]
A = imread('peppers.png'); % sample image
% Set position of the figure in format [left bottom width height]. You want to play with this to set the position right
hFig = figure('Position',[3*ScreenSize(3)/10 ScreenSize(4)/3 ScreenSize(3)/2 ScreenSize(4)/2]);
% Remove the menu and toolbars
set(hFig, 'MenuBar', 'none');
set(hFig, 'ToolBar', 'none');
hIm = imshow(A); % Display your image
pause(2) % Pause execution for 2 seconds.
close(hFig) % Close figure
DummyGUI_2 % Open your GUI
EDIT
Well here is a link to a File Exchange submission to create splash screen;
http://www.mathworks.ca/matlabcentral/fileexchange/30508-splashscreen
Hope that helps
In Matlab figure, I would like to remove ticks only from the top and right axes with keeping the plot box on.
I know if I make the plot box off, the ticks on the top and right go away. But, this is not what I want. In other words, I want to keep ticks only at the bottom and left and, at the same time, want to keep the plot box on.
My workaround similar to #j_kubik proposition:
plot(1:10)
% get handle to current axes
a = gca;
% set box property to off and remove background color
set(a,'box','off','color','none')
% create new, empty axes with box but without ticks
b = axes('Position',get(a,'Position'),'box','on','xtick',[],'ytick',[]);
% set original axes as active
axes(a)
% link axes in case of zooming
linkaxes([a b])
You can use box off to remove the ticks and then draw the box back using plot. For example:
figure
hold on
box off
plot(1:10)
plot([1,10],[10, 10],'k')
plot([10,10],[1,10],'k')
Now in 2022, if anyone is still interested in a quick resolution other than the box option, here is my answer:
figure
plot(1:10) ;
ax = gca ;
ax.Box = 'off' ;
xline(ax.XLim(2),'-k', 'linewidth',ax.LineWidth);
yline(ax.YLim(1),'-k', 'linewidth',ax.LineWidth);
I want to add a x-axis line at 0 to a Matlab figure so that I can compare my data to see if it is positive or negative when saving the figures to a jpg. What is the best way to do this? I know you can use line() but it just seems cumbersome because you need to specify the x and the y ranges. Is there an easier way?
There exist an undocumented function graph2d.constantline:
plot(-2:5, (-2:5).^2-1)
%# vertical line
hx = graph2d.constantline(0, 'LineStyle',':', 'Color',[.7 .7 .7]);
changedependvar(hx,'x');
%# horizontal line
hy = graph2d.constantline(0, 'Color',[.7 .7 .7]);
changedependvar(hy,'y');
The nice thing is that it internally implements a listener for the axes limits (handles change like pan, zoom, etc..). So the lines would appear to extend to infinity.
You could get this x range directly after the figure has been created. It goes a little something like this:
x=-2:5;
y=x.^2-1;
figure()
plot(x,y);
xlim = get(gca,'xlim'); %Get x range
hold on
plot([xlim(1) xlim(2)],[0 0],'k')
Note that if you do any manual zooming out in the figure, the line might have to be redrawn to go over the entire new x range.
I don't believe there is a built-in way that is more convenient. I use hline() and vline() from FileExchange, which work like a charm:
http://www.mathworks.com/matlabcentral/fileexchange/1039
A vline and hline command like in GNU R would be great, but I could not find a shorter solution than
plot(1:10,sin(1:10));
line(xlim,[0 0],'Color','r')
Draw your data by plot() command or stem(). A figure window will open.
Then on the figure window, click on the [insert] command from the
menu bar, a drop-down menu will appear.
From this menu click on the [line] command, now the shape of the
cursor will change into a plus sign.
Now you can draw a line anywhere you want, either horizontal or
vertical or slanted.
You can change the properties of line by right clicking on the
line, a menu will appear from which you can choose your desires
properties.
If you want to have some ticks on the line then you can use add
text option, and place text where ever you want.
If you would like to have a code for your figure, click on [file]
menu and then click on [generatecode] option, a new text editor
window will open, you can save this code for further use. Good luck.
Since MATLAB R2018b there is yline for this purpose:
yline(0)
draws a horizontal line at y==0.