python3.7 problem with validation - it doesnt work

MRAB python at mrabarnett.plus.com
Wed Sep 19 13:30:10 EDT 2018


On 2018-09-19 13:12, alon.najman at gmail.com wrote:
> python3.7 problem with validation - it doesn't work.
> 
In what way doesn't it work? Does your computer explode?

[snip]

> 
>      def printMessage(self):
>           global UserSymbol
>           global UserStockPrice
>           global RadioButtonBellow
>           global RadioButtonAbove
>           global UserGmail
>           global PassGmail
>           UserSymbol=self.textEdit.toPlainText()
>           UserSymbol=UserSymbol[0:4]
>           UserStockPrice=self.textEdit_7.toPlainText()

Here you set UserGmail and PassGmail to the contents of some text edits:

>           UserGmail=self.textEdit_5.toPlainText()
>           PassGmail=self.textEdit_4.toPlainText()
> 
Judging by the names, I'd guess that they are strings.
> 
> #here is the IF of the validation!

Here your check whether they are 0, which is a number:

>           if PassGmail==0 or UserGmail==0 or UserSymbol==0 or UserStockPrice==0 or (RadioButtonAbove==0 and RadioButtonBellow==0):

Strings aren't numbers, and numbers aren't strings. "0" != 0.

>                def Mbox(title, text, style):
>                    return ctypes.windll.user32.MessageBoxW(0, text, title, style)

Here you've indented the line more than the def Mbox, so this line is 
inside the function:

>                    Mbox('you need to enter all data first', 'you need to choose Stock value,price,bellow/above price', 1 )
> 
You're not calling it.

[snip]



More information about the Python-list mailing list