AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
![]() (lambda: enterNewHardware(self))ĪzureServer = ""ĭriver = "The attributes common to HardwareTab and EnhancedHardwareTab are not created by inheritance, but rather by calling an inherited method. Self.activeCheckbox = QCheckBox("ACTIVE") Button = QPushButton("SEARCH/EDIT HARDWARE") Self.cfButton = QPushButton("CLEAR FIELDS") tWindowTitle("HARDWARE | SOFTWARE MANAGER") It's hard to debug when the app isn't throwing any error codes.įrom PyQt5.QtWidgets import (QLabel, QPushButton, QLineEdit, QApplication, QCheckBox, QMainWindow, QWidget, But I need that data to be entered into my database. Although if I just print the text boxes it does work. I tried using the lambda function in my code but the app just closes when clicking the button and no data is entered. To me it seems you're just creating another separate instance of the text boxes? Obviously it works since I see the output and tested the print function in my code and it printed. The code you wrote with the lambda function confuses me. ![]() I thought if a class or function inherited another class then the child class can access any of the objects within the parent class? I thought inheritance was pretty much extending the parent class. I understand what you're saying but at the same time confused. Of course the other thing you could do is make the order function a method of the hardwareTab. Also notice that the text I entered in the snTextBox (This is the text I entered) is printed out by the newHardware() function. These are the QLineEdit objects you are looking for. Text This is the text I enteredNotice that the object ID's printed in the hardwareTab._init_() match the ID's of the objects passed to the newHardware() function. To make this work you need to pass the original hardware tab object, the one that has the text boxes that hold the text you entered. Also notice that nothing was printed for snTextBox.text(). It makes a different snTextBox widget (id 0x28f730f3440). This calls the hardwareTab._init_() and creates a snTextBox widget. When I push the enButton it creates a new newHardware object. Notice the object ID for the textbox (0x28f730188c0). ![]() TextThe first three lines in the output are the hardwareTab object being created. ![]() Self.enButton = QPushButton("ENTER NEW HARDWARE") QMainWindow, QWidget, QVBoxLayout, QTabWidget The textboxes in the enterNewHardware object are not the same textboxes that are in the hardwareTab.įrom PySide2.QtWidgets import QPushButton, QLineEdit, QApplication, \ There is no relationship between the hardware tab object and the enterNewHardware object. ![]()
0 Comments
Read More
Leave a Reply. |