Py4d beginner
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/03/2012 at 12:37, xxxxxxxx wrote:
I started learning Python about 1 year ago, I'm fimiliar with Pythonsyntax and meanwhile with OOP structures as well.
Now I'm trying to get deeper into Py4d so these are my first steps.I have a very basic problem:
from c4d import gui
gui.QuestionDialog("Do you think I am a dialog?")
if True:
print ("You are right.\n I am a dialog")
else:
print ("You are wrong.\n I really am a dialog.")
Basicly this works but its buggy.
The documentation says the gui.QuestionDialog() pops up a dialog with a "yes" and "no" button and returns ****True if the user answered Yes, otherwise False.
But in my case I get True either way, at least I get the print from the True value either way. No matter if click "yes" or "no".Why? ****
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/03/2012 at 12:49, xxxxxxxx wrote:
Hi kornyclown,
You need to assign the return-value of the function to a variable and test that variable in the
if-clause. Checking for if True: will always succeed because True actually is True.from c4d import gui answer = gui.QuestionDialog("Do you think I am a dialog?") if answer: print ("You are right.\n I am a dialog") else: print ("You are wrong.\n I really am a dialog.")
-Niklas
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 19/03/2012 at 13:31, xxxxxxxx wrote:
Ah, ok that makes sense, I didn't consider that True is always True. I was thingking a bit too "human".
Works fine, thanks a lot.