Solved Function running before it is expected
-
Hello, I use this code here: https://github.com/Axel-Erfurt/OrthoViewLite/blob/main/OrthoViewLite.py
I have written a function in order to do some processing. Where should I call it in order to do the processing, after the 3 files ( I changed the code to include total 3 file buttons, everything runs ok to this point) are inserted? Because as I call it now it runs before the 3 files are inserted, although I call it at the end of init(self, parent=None) function. I defined it between the positions:def openFile()
and
def getFrame()
I see different behaviour (if I am not wrong) of the python functions comparing to C/C++ (where they execute only where you call them). Thanks...
-
Hi,
Don't call your function in
__init__
. This will just make it run every time you create an object of that class. What you want is to check if all the files have been selected each time one of the buttons are clicked and only then call it. -
Ok I found the error...
I want to compare two strings and check if they are the same. For example, this string:
"This is a sentence"
with this:
" This is a sentence "
As can be seen they are not to the same since the last sentence has before and after the sentence spaces. How do I do this kind of comparisons?
-
@john_hobbyist
Do what kind of comparisons? Are you really asking someone to tell you to/how to strip spaces?