Thanks for the suggestion. I'll nest my CheckoutPopup (spindemo) inside my main code if I have to, but I'm wondering if it's possible to take a variable from my AdminMenu.py and use it in my CheckoutPopup.py?
I'm trying to take the "name" variable (or TestVariable) and bring it over to my CheckoutPopup.py
Is there a way to carry the variable over to the other code or is it just better to have the CheckoutPopup nested inside my AdminMenu.py?
Snippet from AdminMenu.py
Update:
---------------------------------------------
So I tried bringing the CheckoutSpinBox.value() to my AdminMenu.py but I get 0 every time. It's a step further but I need the value that the user entered once the Confirm Button is clicked (ConfirmClicked) not the default value of the spinbox (0). Is there a way to get that value the way I'm currently trying to do it?
Here's what I did in my AdminMenu.py
I'm trying to take the "name" variable (or TestVariable) and bring it over to my CheckoutPopup.py
Is there a way to carry the variable over to the other code or is it just better to have the CheckoutPopup nested inside my AdminMenu.py?
Snippet from AdminMenu.py
def getCellText(self): if self.InventoryDisplay.selectedIndexes(): item = self.InventoryDisplay.selectedIndexes()[0] row = self.selectedRow() column = self.selectedColumn() if not item == None: name = item.data() self.sbar.showMessage(str(name)) #For Testing: global TestVariable TestVariable = item.data() print(name)Snippet from CheckoutPopup.py:
def currentValue(self): #Show the current value of the SpinBox in real time from AdminMenu import TestVariable self.messageText.setText("You are taking: "+str(self.CheckoutSpinBox.value()) + " " + TestVariable)Error:
Error: from AdminMenu import TestVariable
ImportError: cannot import name 'TestVariable' from 'AdminMenu'
---------------------------------------------Update:
---------------------------------------------
So I tried bringing the CheckoutSpinBox.value() to my AdminMenu.py but I get 0 every time. It's a step further but I need the value that the user entered once the Confirm Button is clicked (ConfirmClicked) not the default value of the spinbox (0). Is there a way to get that value the way I'm currently trying to do it?
Here's what I did in my AdminMenu.py
#---------------------------------- #Checkout Function def CheckoutClicked(self): #Print in terminal for testing: print("The Checkout Button was clicked") from CheckoutPopup import Ui_CheckoutPopup x = Ui_CheckoutPopup() x.ConfirmClicked() print(x.CheckoutSpinBox.value()) self.win = Ui_CheckoutPopup() self.win.show() #self.close() #----------------------------------