Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Container “Not defined”
Post: RE: Container “Not defined”

That makes ne sense at all. x.intersection(x) == × So x.intersection(x.intersection(y)) == x.intersection(y)
deanhystad General Coding Help 23 620 Jun-18-2021, 04:55 PM
    Thread: tkinter showing image in button
Post: RE: tkinter showing image in button

Looks like there is a linefeed at the end of your filename.
deanhystad GUI 3 127 Jun-16-2021, 01:49 AM
    Thread: Python 3.10 and PyQt5(6)
Post: RE: Python 3.10 and PyQt5(6)

It is a reported bug. https://bugs.python.org/msg395136
deanhystad GUI 2 155 Jun-14-2021, 05:02 PM
    Thread: loop running indefinitely
Post: RE: loop running indefinitely

A first pass could be splitting the USA and Australia requests out into their own functions. import requests import json import argparse import time import pandas as pd import warnings warnings.filter...
deanhystad General Coding Help 4 161 Jun-14-2021, 04:52 PM
    Thread: I am getting a NameError that is not defined and not sure why it happen
Post: RE: I am getting a NameError that is not defined a...

This is interesting. def test(): a = 0 exec("print(dir())") test()Output:['a']exec is "inheriting" variables defined in the local scope, but these must not be the same variables. Changing th...
deanhystad General Coding Help 5 199 Jun-14-2021, 03:41 PM
    Thread: loop running indefinitely
Post: RE: loop running indefinitely

I don't see it running forever, but the logic looks odd. I think what you are trying to do is process years up to 1985 using the USA API and from 1985 onward using the Australia API. This is not wha...
deanhystad General Coding Help 4 161 Jun-14-2021, 02:06 PM
    Thread: I am getting a NameError that is not defined and not sure why it happen
Post: RE: I am getting a NameError that is not defined a...

I get a name error when running the program. Maybe a difference between Windows and Linux? exec() is obviously creating a new scope and "a" has not been defined outside that scope. This works: def ...
deanhystad General Coding Help 5 199 Jun-14-2021, 01:22 PM
    Thread: Halting if command if gpio triggered event triggered
Post: RE: Halting if command if gpio triggered event tri...

Only allow motion when the associated limit switch is not pressed. stepper1 = None stepper2 = None while True: if keyboard.is_pressed('f') and not button12.is_pressed: stepper1 = stepper.B...
deanhystad General Coding Help 5 245 Jun-13-2021, 01:50 PM
    Thread: Mapping a range
Post: RE: Mapping a range

What is the range of the ADC? Is it 0 to 3.3V, -3.3 to 3.3V. Is it a 5 volt ADC? Is there a programmable gain? My assumption was a 12 bit ADC with an input range 0..3.3V and gain of 1. I'm sorry ...
deanhystad General Coding Help 5 286 Jun-12-2021, 10:33 PM
    Thread: Mapping a range
Post: RE: Mapping a range

volts = pin_value * 3.3 / 4095 scalar =pin_value / 4095 percent = pin_value * 100 / 4095
deanhystad General Coding Help 5 286 Jun-12-2021, 07:46 PM
    Thread: Dice Roll (Find out how many rolls until specified streak)
Post: RE: Dice Roll (Find out how many rolls until speci...

I like to start out by first solving the problem the same way I would solve it if I were doing so without a computer. 1. Set count and snake eye count = 0 2. Roll the dice 3. If roll is snake eyes, i...
deanhystad General Coding Help 4 316 Jun-12-2021, 07:43 PM
    Thread: Remove label after x seconds
Post: RE: Remove label after x seconds

I opened a word document, edited the text and saved the file. The status bar says "somefile.docx saved to this PC". 10 minutes from now it will say "somefile.docx saved to this PC". An hour from no...
deanhystad GUI 3 117 Jun-11-2021, 08:03 PM
    Thread: Python calculator help but not using while loop with true, any flags variable ,break
Post: RE: Python calculator help but not using while loo...

It does what you want. You must be using it wrong
deanhystad Homework 13 453 Jun-08-2021, 02:46 AM
    Thread: Python Style and Naming Variables
Post: RE: Python Style and Naming Variables

The less you reuse names the easier it is to find things by name. In Python you can use the same name for a module variable and a function variable, but there will always be a moment of hesitation wh...
deanhystad General Coding Help 3 262 Jun-07-2021, 09:30 PM
    Thread: Python calculator help but not using while loop with true, any flags variable ,break
Post: RE: Python calculator help but not using while loo...

It does work for a zero divisor. Did you try it? It will keep looping until you type something that is not zero. Granted everything crashes horribly if you enter something that cannot be evaluated ...
deanhystad Homework 13 453 Jun-07-2021, 09:13 PM
    Thread: Python calculator help but not using while loop with true, any flags variable ,break
Post: RE: Python calculator help but not using while loo...

Your program doesn't allow solving multiple equations, one of your stated requirements. You ask for the operator inside a loop but you don't ask for the operands. Given that you want to allow solvin...
deanhystad Homework 13 453 Jun-07-2021, 04:16 PM
    Thread: Python calculator help but not using while loop with true, any flags variable ,break
Post: RE: Python calculator help but not using while loo...

Can you use a function with a return?
deanhystad Homework 13 453 Jun-07-2021, 02:31 AM
    Thread: Embed Python console in GUI application
Post: RE: Embed Python console in GUI application

You should also look at qtconsole. It gives you a very pretty, feature rich console.
deanhystad GUI 5 1,919 Jun-04-2021, 05:10 PM
    Thread: Post IF Statement Input
Post: RE: Post IF Statement Input

Why convert input to an int? Are you doing math? If you don't need need a number variable why go to the extra hassle of using a number variable. If your program converts C to F or F to C why does t...
deanhystad Homework 2 243 Jun-04-2021, 05:03 PM
    Thread: ImageTk Paste
Post: RE: ImageTk Paste

The snapshot method opens a dialog, and if successful opens a second dialog. It opens two dialogs because you wrote the code that way. Then it proceeds to perform actions that don't make sense. You...
deanhystad General Coding Help 13 616 Jun-03-2021, 03:27 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020