0

This is my home window.

This is my home Window of the Application.

After clicking the log in button.

This is the Window of my application after clicking the LOG IN button.

Now, as you could see that the button is not raised.

I am attaching the code snippet of what happens after clicking the button.

    self.org_frame=Frame(self.root,relief=RIDGE,bd=4,bg="#F7DC6F")
    self.org_frame.pack()
    
    self.org_lbl=Label(self.org_frame,text="Organisation ID",fg="black",bg="#F7DC6F" ,font=("helvetica","18","bold"))
    self.org_lbl.grid(row=0,column=0)

    self.txt_org=Entry(self.org_frame,width=12,textvariable=self.organisation_id, font=("times new roman",18,"bold"),bd=5)
    self.txt_org.grid(row=0,column=1,pady=10,padx=20)

    self.org_lbl=Label(self.org_frame,text="Password",fg="black",bg="#F7DC6F" ,font=("helvetica","18","bold"))
    self.org_lbl.grid(row=1,column=0)

    self.txt_org=Entry(self.org_frame,width=12,show='•',textvariable=self.organisation_log_password_var, font=("times new roman",18,"bold"),bd=5)
    self.txt_org.grid(row=1,column=1,pady=10,padx=20)
    self.new_btn=Button(self.org_frame,text="New? Sign Up!",width=12,font=("times new roman",16,"bold"),bd=3,cursor="hand2",bg="orange",command=self.new_def)
    self.new_btn.grid(row=2,column=0,padx=10,pady=10)   

    self.log_btn=Button(self.org_frame,text="Log In",width=10,font=("times new roman",12,"bold"),bd=3,cursor="hand2",bg="lightgreen",fg="green")
    self.log_btn.grid(row=2,column=1,padx=10,pady=10)
    self.log_btn.bind("<Button-1>",self.org_log)
    self.root.bind("<Return>",self.org_log)

def new_def(self):   
    messagebox.showinfo("New Account!","To create new Organisation kindly mail us your request\nat aakarsh2504@gmail.com.")  
    
def org_log(self,event):      
    if str(self.organisation_id.get()).lstrip()!="" and str(self.organisation_log_password_var.get()).lstrip()!="":
        try:
            int(self.organisation_id.get())
        
            try:
                con=mysql.connector.connect(host=self.developer_host,user=self.developer_user_id,port=self.developer_port,password=self.developer_password,database=self.developer_database)
                cur=con.cursor()
                
                cur.execute("select host from data where id="+self.organisation_id.get())
                self.host=(cur.fetchone())[0]
                
                cur.execute("select user from data where id="+str(self.organisation_id.get()))
                self.oragnisation_user_id=(cur.fetchone())[0]
                
                cur.execute("select db_password from data where id="+self.organisation_id.get())
                self.organisation_password=(cur.fetchone())[0]
                
                cur.execute("select port from data where id="+str(self.organisation_id.get()))
                self.organisation_port=(cur.fetchone())[0]
                
                cur.execute("select name from data where id="+self.organisation_id.get())
                self.organisation_name=(cur.fetchone())[0]
                
                cur.execute("select database_name from data where id="+str(self.organisation_id.get()))
                self.organisation_database=(cur.fetchone())[0]
                
                cur.execute("select organisation_password from data where id="+str(self.organisation_id.get()))
                self.organisation_log_password=(cur.fetchone())[0]

                cur.execute("select version_required from my_persnol_info where id=1")
                self.required_version=(cur.fetchone())[0]
                
                cur.execute("select developer_email from my_persnol_info where id=1")
                self.developer_email=(cur.fetchone())[0]
                con.commit()
                con.close()
                if self.required_version==self.version:

                    if str(self.organisation_log_password_var.get()).lstrip()==str(self.organisation_log_password):

                        self.org_start()
                    else:
                        messagebox.showerror("Incorrect","Please enter a correct password.")
                else:
                    messagebox.showerror("UPDATE",f"You are using and older version of application which is {self.version};\nPlease update it to latest version which is {self.required_version};")
            except TypeError:
                messagebox.showerror("Not Found","Your Organisation was not found")
            except:
                messagebox.showerror("Error!","Please check you Internet connectivity or\ncontact the Admin of your Organisation.")

        except ValueError:
            messagebox.showerror("Error!","Please enter valid Organisation ID.")
    else:
        messagebox.showerror("Must!","All details are must.") 

It happens like that when complete details are not entered in the entry box and the message box pops up.

I searched for my issue and got the reason for the same but was unable to find the solution. I am attaching the link of the issue and its reason. I just need a solution to the issues.

Aakarsh Kumar
  • 108
  • 2
  • 10
  • @acw1668 This is what is seen after closing the message box. While the button is clicked and the message is in the display, the button is raised but when I close the message box and it is removed from display, it gets pressed inside and didn't raise afterwards. – Aakarsh Kumar Dec 28 '20 at 11:25
  • 1
    Add `return "break"` at the end of `org_log()` function will solve the issue. Also, use `command` option instead of `bind()` to trigger `org_log()`. – acw1668 Dec 28 '20 at 11:26

1 Answers1

0

Add return "break" at the end of org_log() function will solve the issue.

Aakarsh Kumar
  • 108
  • 2
  • 10