473,385 Members | 1,267 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to initialize a variable only one time when program starts

2
For example I have a button and I would like to use it to turn something on and off with the same button.
So I thougt, I would use some wariable which woild keep track of the state, but I can't seem to make it work.
I would need to initialize X to value 0, but that initialization should happen only once when the program starts.

x = 0 -> (this part should happen only when program is started)

if x == 0:
turn switch on
x = 1
else:
turn switch off
x = 0
Sep 2 '13 #1
1 1400
vehi
2
I found another solution.
I used a ToggleButton and .get_active() method
to get the state of a button.
Sep 2 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: cwdjrxyz | last post by:
Several threads have discussed the accuracy of time calculated using script when Daylight Saving Time (DST) is considered. A page at http://webexhibits.org/daylightsaving/ gives much information on...
29
by: keredil | last post by:
Hi, Will the memory allocated by malloc get released when program exits? I guess it will since when the program exits, the OS will free all the memory (global, stack, heap) used by this...
5
by: chellappa | last post by:
hi, i want to find the ruuning time of program using c .. problem: i want to find the running time of program using c , i have one routine in c,,, i want to find how much , its take for...
8
by: lovecreatesbea... | last post by:
K&R 2, sec 2.4 says: If the variable in question is not automatic, the initialization is done once only, conceptually before the program starts executing, ... . "Non-automatic variables are...
1
by: arice | last post by:
I need to create a timer and begin processing tasks in my asp.net code when IIS starts or restarts. I do not know of any way to execute even my global procedures without some external application...
2
by: Blair | last post by:
Can someone please tell me how to start my application when Windows starts up or when someone logs on (vb 2005) ?
3
by: mikeyeli | last post by:
Good Day people! i need to make an application im making, start when windows starts, i just wanted to ask you how can i do this, or to point me in the right direction. Thanks!
2
by: Jeff Agee | last post by:
Why does my app not load the saved user scope my.settings when it starts by way of the registry run key? This key starts programs after the user login, per microsoft. So why does it not load the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.