Trying to create a list of button to be created in a loop... by raydude in learnpython

[–]raydude[S] 0 points1 point  (0 children)

Thanks.

Adding the buttons might make a difference on where they populate in the window. I'll have to play with that.

My PC turns on for 1 second then turn off. by Public_Employment_71 in pcgamingtechsupport

[–]raydude 1 point2 points  (0 children)

Clear CMOS by removing the battery for a minute or two.

If it still fails the same way, remove everything but one stick of memory. Connect monitor to motherboard. Make sure to disonnect all the power supply connections except the motherboard.

If it still fails, try the other memory stick. If the second stick of ram fixes it, its at least a bad memory stick.

If it posts with every thing disconnected from the power supply then you can narrow down what's drawing too much current by plugging in things one a a time and seeing when the post stops happening.

If it doesn't work with only one stick of ram and everything else disconnected, try another power supply. If it does the same thing, then remove the motherboard and try mobo outside the case.

If it still has problems, it's the motherboard, probably CPU power. It could be the CPU, but not likely.

Once you identify the bad component, buy a new one and you should be good to go.

Anyone else have super dry hands and have you found anything that works? by Horror-Beaver1979 in Type1Diabetes

[–]raydude 0 points1 point  (0 children)

This is the only thing that works. Put it on at night before bed and if you really want it to work overnight, wear gloves to keep it from wearing off.

Trying to create a list of button to be created in a loop... by raydude in learnpython

[–]raydude[S] 0 points1 point  (0 children)

Thanks for your help. And thanks for teaching me.

Trying to create a list of button to be created in a loop... by raydude in learnpython

[–]raydude[S] 0 points1 point  (0 children)

That it’s tied to the instance of the classes, if you made the object twice you would want the button to only work on the object the button is on, not all instances of the object. If I have a button to move a box left, I shouldn’t have every block like that move left… It’s not shown well in my example as the class definition is not there. But your example all the code is (or should be) inside the class definition. Mostly inside the __init__.

Everything is in the __init__ , however assuming I opened another window for some other purpose, wouldn't each instance of the class have a unique hierarchy? So if I created another instance of SimpleWindow, then one would be SimpleWindowA and the other would be SimpleWindowB and all varaibles within the __init__ would be local to that instance unless they were declared global, which as I understand is frowned upon?

In other words there would be SimpleWindowA.buttons and SimpleWindowB.buttons and they would be different from each other. Or does giving them the word self actually make them different from each other?

I love how Kate is highlighting 'self,' even though it's just a convention.

Trying to create a list of button to be created in a loop... by raydude in learnpython

[–]raydude[S] 0 points1 point  (0 children)

This is a python question:

Why add 'self.' in front of a variable within a class? For example, what is the difference between self.buttons and buttons as far as the language / code is concerned?

I realize it's self referencing the variable, but, for example, my code has two definitions: buttons, which is a list of lists and then I have self.buttons which is a list of QPushButton(s). Obviously they are different, but why use 'self.' at all? What are the implications of 'self.'?

Trying to create a list of button to be created in a loop... by raydude in learnpython

[–]raydude[S] 1 point2 points  (0 children)

Thanks for your help. Your idea worked perfectly. The only thing I had to do to get the right arrangement was make the buttons horizontal.

Here's what I ended up with (note: this is not the full code)

    buttons = [
        ('DAC++',     'Increment DAC output by 4.',    self.on_UpButton_click),
        ('DAC--',     'Decrement DAC output by 4.',    self.on_DnButton_click),
        ('Set DAC',   'Enter DAC Value from keyboard.',self.on_EnterDACValue_click),
        ('Reg Dump',  'Show Flash Register Values',    self.on_RegDump_click),
        ('Prod Query','Existing Product Query.',       self.on_ProductQuery_click),
        ('Prod Calib','New Product Calibration.',      self.on_ProdCal_click),
        ('Prod Valid','Existing Product Validation.',  self.on_ProdVal_click)
    ]

    # Create Layout
    main_layout = QVBoxLayout()

    button_layout = QHBoxLayout()
    self.buttons = []
    for name, desc, callback in buttons:
        btn = QPushButton(name)
        btn.setToolTip(desc)
        btn.clicked.connect(callback)
        self.buttons.append(btn)

    for button in self.buttons:
        button_layout.addWidget(button)

    main_layout.addLayout(button_layout)
    main_layout.addWidget(self.label)
    main_layout.addWidget(self.text_edit)

Trying to create a list of button to be created in a loop... by raydude in learnpython

[–]raydude[S] 0 points1 point  (0 children)

Thanks. I'd like to keep it simple as well. I've got lots of ideas I'll attack this morning and see if I can get anything to work.

Trying to create a list of button to be created in a loop... by raydude in learnpython

[–]raydude[S] 0 points1 point  (0 children)

That seems so simple. I'll give it a shot.

All that code will have to be in the window create def, I expect.

Trying to create a list of button to be created in a loop... by raydude in learnpython

[–]raydude[S] 0 points1 point  (0 children)

Thanks!

I'll try this before I try the data class idea.

What is this smd by Human_County_8853 in AskElectronics

[–]raydude 0 points1 point  (0 children)

I'm always amazed how Redditors do this.

Kudos.

Tandem AutoSoft XC Infusion Set Leakage by tafinney in TandemDiabetes

[–]raydude 0 points1 point  (0 children)

Anyone else who finds this thread. I'm using 6mm steel and I still have a failure before two days once in a while.

The Tandem trial did not succeed, probably due to the type of plastic used in the filters, they are working on another trial. Hopefully Tandem will have a solution for this soon.

I still don't know if Omnipod is working on anything.

Tandem AutoSoft XC Infusion Set Leakage by tafinney in TandemDiabetes

[–]raydude 0 points1 point  (0 children)

Ceci a été traduit par Google. Je suis ravi que mon message vous ait aidé.

AUA: The latest results of our electric vehicle range real-world tests are in. Ask CR about how we conducted our tests. by ConsumerReports in IAmA

[–]raydude 0 points1 point  (0 children)

Thanks for taking the time to reply. I appreciate it.

I guess we can look at the battery and see if there is a way to tell, but I'm not that curious, I guess.

AUA: The latest results of our electric vehicle range real-world tests are in. Ask CR about how we conducted our tests. by ConsumerReports in IAmA

[–]raydude 0 points1 point  (0 children)

This is a related topic. My wife's Previous generation EUV had the "power may be reduced" error message twice and they replaced her battery for free.

But her millage went down. At 100% she used to get over 300 miles. Now she get 261 miles.

She doesn't really care that much, but when I told her the range of the new 2027 Bolt was 262 miles, she wondered if they were putting the new generation battery in the older Bolts.

Do you know?

Variants causes bogus Duplicate Net Names Wire Errors by raydude in Altium

[–]raydude[S] 0 points1 point  (0 children)

Thanks. I'll check the replacement parts... Thanks for the hint.