How to change a variable for the whole program - class

So I have a program with a Tkinter interface. I used just one class and a few commands but when I change a variable in a command it doesn' t change it for the whole program, but only in the command. How can I make that variable change for the whole program in a command?

Use global to declare a global variable
global myVar

Related

Fish shell git_prompt inside TIDE

Is it possible to force Fish shell extention TIDE to
use fish_git_prompt instead of its own _tide_item_git.fish?
My goal is to make TIDE git prompt identical to this tutorial.
Right now with default TIDE setting I have this git prompt:
However, I want to make it look like this, but still use TIDE:
Source image
fish, version 3.2.1
Fedora 33
So what that tide function does is simply collect the git info and print it. Tide calls it, takes what it prints, and puts it in the correct place. This is also how the fish_git_prompt works - it prints the git stuff, your prompt is responsible for putting that in the correct place.
Simplified:
function fish_prompt
set gitstuff (_tide_item_git)
# do other tide stuff
printf '%s' $gitstuff $otherstuff
end
When fish calls a function, it goes through $fish_function_path for a file with the name of the function (plus a ".fish" suffix).
So what you would simply do is make your own function _tide_item_git, and put it first in $fish_function_path.
I'm not sure how you've installed tide, I'm assuming it's not directly in ~/.config/fish/functions - the normal directory for your functions. That's the simple case, so you can just call funced _tide_item_git, which will open it in your editor, and replace it with
function _tide_item_git
fish_git_prompt
end
then run funcsave _tide_item_git once you're happy.
In the more complicated case, make another directory for your functions - ~/.config/fish/myfunctions maybe - add it to $fish_function_path:
set -g fish_function_path ~/.config/fish/myfunctions $fish_function_path
(put that in config.fish)
make a file called _tide_item_git.fish there and put the above function in.

In IAR embedded workbench spy macro, is there have variable of breakpoint's function name?

When I use message with macro script like below:
__message "cctimer = ", #CCTIMER1
I would like to display the function name which use with breakpoint.
Is there variable like c, __function__ which could I use in marco script!
(At the current stage, I pass the function name through the expression.)
Using C-SPY macros of IAR
Unfortunately the only way for a C-SPY macro to know the name of the function the calling breakpoint is set in is by having it passed through the expression. There is no built in variable that contains the function name nor is there any way to inspect the call stack from within a macro.

User to change a variable in a compiled macro

I have a variable with a value stored in an AutoHotKey macro. I want the user to be able to change the variable whenever they want and to have the macro use the new value stored in the variable when the macro is launched in the future. Is it possible to change a variable in a running macro and have the macro use the new variable value the next time the macro is launched? Alternatively, is there a way for the user to change a variable in a compiled macro? I'm also wondering about how to the user interface would be like for the user to be able to change the variable when the user chooses to change the variable?
Sure, you can store the variable in a text file. This will be the most simple and reliable method to change a variable and store it permanently.
Here is an example. Create a file "config.txt" in the same directory and put the text there. Pressing F1 will reload the text file into variable v.
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
fname := "config.txt" ; define file name (must be in the same directory)
loadvar(fname) ; load file
return ; end main
; loadvar function
loadvar(fname){
global v
FileRead, v, %fname%
tooltip %v%
}
; reload variable
F1::
loadvar(fname)
return

Retrieve a variable from a function that crashed matlab

Is there a way to retrieve the output of a function that did not complete properly?
For instance, a (non global) variable that was correctly computed by a function but that couldn't be saved properly because of syntax errors.
In principle, you can't look into a function once the program has stopped with an error. (That's why I often try to avoid functions.)
However, you can achieve what you want by entering debugging mode, using the dbstop function to set a breakpoint:
The dbstop function is used to temporarily stop the execution of a
program and give the user an opportunity to examine the local
workspace.
In particular, typing
dbstop if error
in the command window before running your code will make it stop at the point that caused the error and look at the variables within that function.
To restore normal behaviour you need the dbclear function. Type
dbclear if error
to remove the previously set breakpoint, or
dbclear all
to remove all breakpoints.

how to delete variables in matlab command window?

I want to delete some variables that I have declared in command window in matlab, I tried clear all but it didn't work. I typed the following in the command window,
e.g.
a = 10;
str = 'a';
clear all
Matlab doesn't delete them, why?
Is there any function that can do this for me?
1)
If you have redefined function clear (e.g. by a variable or function), you can use the builtin function to execute built-in clear function.
I.e. you can use
builtin('clear','all')
to clear all variables,
respectively
builtin('clear','clear')
to redefine clear to the built-in clear function and then use it normally
clear all
2) If this was not the solution of your problem, could you show us the output of the following code?
a = 10;
str = 'a';
builtin('clear','all')
builtin('who')
To clear all of your variables in matlab you type:
clear
If you want to clear a specific variable, for instance "a" you tpye:
clear a
I suspect your problem is that you have named a variable "all" so when you use clear all you end up only clearing the variable all.
You should be careful about what names you are giving to your variables. You can useexist {variable} to check if the variable you want to assign is already used by a matlab function.
use "Clear" only it will work or u want to remove particular variable the put variable name in last of " Clear Var_name"