Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Programmatically creating buttons that remember their positions
Post: RE: Programmatically creating buttons that remembe...

(Jun-21-2023, 06:54 PM)Gribouillis Wrote: You could also store the row and column as attributes in the Button instance That's fantastic, but both solutions provided had a commonality that ended up b...
Clunk_Head GUI 6 1,412 Jun-21-2023, 08:20 PM
    Thread: Programmatically creating buttons that remember their positions
Post: RE: Programmatically creating buttons that remembe...

(Jun-21-2023, 05:09 PM)DeaD_EyE Wrote: With a trick, you could use command with partial, to call the callback together with the instance of the button itself as the first argument. Thank you. Looks...
Clunk_Head GUI 6 1,412 Jun-21-2023, 06:29 PM
    Thread: Programmatically creating buttons that remember their positions
Post: Programmatically creating buttons that remember th...

I'm looking to create buttons that remember where they are are in a 2D list. This way they can share a single function that takes their 2D list indices as parameters. Ultimately, I want the button to ...
Clunk_Head GUI 6 1,412 Jun-21-2023, 02:20 PM
    Thread: Passing string functions as arguments
Post: RE: Passing string functions as arguments

I knew it was something simple. Thanks a bunch
Clunk_Head General Coding Help 3 1,299 Jun-15-2022, 04:51 AM
    Thread: Passing string functions as arguments
Post: Passing string functions as arguments

I want to pass string functions like string.upper into another function as a parameter, there to be called as a function. A simplified example: def transform_nth(str_in, n, transform): return ''.j...
Clunk_Head General Coding Help 3 1,299 Jun-15-2022, 04:44 AM
    Thread: Understanding parentage in environment diagrams
Post: Understanding parentage in environment diagrams

I'm confused about defining the parent of a function as the frame in which the function is defined as it pertains to a HOF that defines a function and then drops out of scope. def foo(x): print(f'...
Clunk_Head General Coding Help 1 1,073 Jun-05-2022, 11:02 PM
    Thread: Detecting float or int in a string
Post: RE: Detecting float or int in a string

Here's how I settled it to meet pythonic standards as well as those I was raised on. In this application, a calculator, I was originally doing this: 1) Try to convert to float 2) except, check against...
Clunk_Head General Coding Help 15 4,700 May-25-2022, 04:01 PM
    Thread: Detecting float or int in a string
Post: RE: Detecting float or int in a string

(May-23-2022, 09:30 PM)Gribouillis Wrote: In some other languages, we would need to declare all the exception types that are thrown by the function, which is tedious. But not in Python. I think ther...
Clunk_Head General Coding Help 15 4,700 May-23-2022, 10:12 PM
    Thread: Detecting float or int in a string
Post: RE: Detecting float or int in a string

(May-23-2022, 09:49 PM)bowlofred Wrote: You're doing recursive function calls. Would need to test, but I'd worry that would have a bigger impact on memory than a try block. Good point. I will test i...
Clunk_Head General Coding Help 15 4,700 May-23-2022, 10:09 PM
    Thread: Detecting float or int in a string
Post: RE: Detecting float or int in a string

(May-23-2022, 09:45 PM)Gribouillis Wrote: regular expressions I understand that python has a fast regex engine. I haven't timed it since python 2 though, but then I found regex to be slower than rep...
Clunk_Head General Coding Help 15 4,700 May-23-2022, 10:02 PM
    Thread: Detecting float or int in a string
Post: RE: Detecting float or int in a string

(May-23-2022, 09:01 PM)bowlofred Wrote: Float will handle exponential notation while yours will not. Up to you if that's a problem. Yours will not handle negative numbers or numbers with an explicit...
Clunk_Head General Coding Help 15 4,700 May-23-2022, 09:43 PM
    Thread: Detecting float or int in a string
Post: RE: Detecting float or int in a string

(May-23-2022, 09:01 PM)bowlofred Wrote: I don't see anything wrong with using a try/except for handling an attempt to see if something is or is not compatible with float(). How much memory does it u...
Clunk_Head General Coding Help 15 4,700 May-23-2022, 09:12 PM
    Thread: Detecting float or int in a string
Post: RE: Detecting float or int in a string

(May-23-2022, 08:44 PM)Gribouillis Wrote: I disagree completely with this philosophy Can you please provide an example where an exception must be used in place of anything else? I'd like to expand m...
Clunk_Head General Coding Help 15 4,700 May-23-2022, 08:49 PM
    Thread: Detecting float or int in a string
Post: Detecting float or int in a string

The str.isnumeric() function is lacking when it comes to detecting floats. Several sites say to use a try/except to attempt the conversion. I was taught not to depend on try except in the regular prog...
Clunk_Head General Coding Help 15 4,700 May-23-2022, 08:39 PM
    Thread: It it possible to make a help file explorer with tkinter?
Post: It it possible to make a help file explorer with t...

I've created an interactive guide using tkinter and I'd like to add a helpfileesque navagation pane to it, as similar to this as possible: [Image: https://media.pcwin.com/images/screen/58...sy_chm.gif...
Clunk_Head GUI 0 2,022 Aug-07-2021, 06:02 PM
    Thread: Is rememberme.memory() accurate for recursive structures?
Post: RE: Is rememberme.memory() accurate for recursive ...

(Dec-17-2020, 10:39 AM)Gribouillis Wrote: You could perhaps add a __slots__ member to your classes, especially the nodes and see if it changes anything (I don't know rememberme.memory()). With slot...
Clunk_Head Data Science 2 2,246 Dec-17-2020, 06:07 PM
    Thread: Is rememberme.memory() accurate for recursive structures?
Post: Is rememberme.memory() accurate for recursive stru...

I'm trying to measure the size of my recursively defined data structures, but I'm getting wildly large results. Perhaps it's the tool that I'm using rememberme.memory(). I chose this because sys.getsi...
Clunk_Head Data Science 2 2,246 Dec-15-2020, 02:45 PM
    Thread: Error in code NameError: name ' ' is not defined
Post: RE: Error in code NameError: name ' ' is not defin...

As others have said, you created numb as an int and are then trying to define variables inside of it. There are at least two simple solutions: 1) Define a variable for each case. #Instead of numb.x ...
Clunk_Head Homework 11 6,336 Sep-16-2020, 10:41 PM
    Thread: Newbie: Application/programme to write code
Post: RE: Newbie: Application/programme to write code

I like IDLE available at python.org, but there are a million options. But the specs you posted should be able to handle both of the applications you mentioned. Perhaps find which version to download t...
Clunk_Head News and Discussions 3 2,577 Sep-15-2020, 11:46 PM
    Thread: pip3 install opencv-python fails on 'skbuild'
Post: RE: pip3 install opencv-python fails on 'skbuild'

try: pip3 install opencv-python
Clunk_Head General Coding Help 2 5,795 Sep-15-2020, 06:32 AM

User Panel Messages

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