Posts
 
Reputation
Joined
Last Seen
Ranked #2K
Strength to Increase Rep
+2
Strength to Decrease Rep
-0
90% Quality Score
Upvotes Received
15
Posts with Upvotes
14
Upvoting Members
7
Downvotes Received
2
Posts with Downvotes
2
Downvoting Members
1
1 Commented Post
~79.0K People Reached
About Me

Science and Math Researcher (For Fun)

Interests
Rock, Science, Math, History, Economics
Favorite Tags
Member Avatar for HiHe

This can be accomplised in one line using "lambda" and a one line "if/else" statement: `t_btn = tk.Button(root, text="True", width=12, command = lambda: t_btn.config(text="False") if t_btn.config('text')[-1] == 'True' else t_btn.config(text="True"))`

Member Avatar for martineau
1
21K
Member Avatar for grand_78

First off, ignore my non-PEP-8 compliant coding, and just change them as needed. I left your code intact up to and including line 13, `total_value = get_total(pennies, nickels, dimes, quarters)` I eliminated your get dollars and getcents functions, as you can get those with one short line using `divmod`. `divmod` …

Member Avatar for BustACode
0
2K
Member Avatar for vegaseat
Member Avatar for SagarK95

I had the same problem as you when I eliminated the semicolons--The object kept moving wildly around. Turns out that one must be judicious in removing the semicolons on line 23, as the result may not--mine didn't--indent properly. Once I preserved the proper indentation, all was well.

Member Avatar for BustACode
0
440
Member Avatar for JOSheaIV

I think the redesign of the site is a disaster. I thought that the first moringing it was up, and still do. Seems it was designed by someone that does not know, and/or understand the Web desing mantra of "Don't make them think." Site navigation here has sort of become …

Member Avatar for Popc0rn
1
2K
Member Avatar for fonzali

Great stuff thanks. I'm running 2.7 I had to change `quit()` on line 54 to: root.destroy() sys.exit() Otherwise my run of it would hang on cancel. Also in 2.7, I had to change some of the imports, and line 72, because several Tkinter modules have been change in 3.+ from …

Member Avatar for fonzali
2
2K
Member Avatar for BustACode

I found that one can use dictionaries to hold Tkinter widget config and display parameters. This then permits one to have these dictionaries elsewhere in the code for easy modification instead of buried within the code for each widget. I particularly like to place these dictionaries toward the top of …

0
3K
Member Avatar for BustACode

I have been learning NumPy arrays/matrices in Python. As I worked, I found that I desired a more readable form of 3d matrices. So I figured that writing one would be a good goal and learning exercise. The goal was to create a function that would print 3d NumPy matrices …

0
3K
Member Avatar for vegaseat
Member Avatar for BustACode

Note: In Python 2.7 use: `from __future__ import print_function` to use examples. In Python, by default, the key and value pairs in a dictionary are stored as hashes, therefore dictionaries do not retain the order in which values were added, and cannot be ordered. v_Dict ={} v_Dict["First"] = 99 v_Dict["Second"] …

Member Avatar for DragonMastur
1
476
Member Avatar for vegaseat

Good stuff, and ideas. Thanks. I am not a "spammer," but I do eat Spam. Does that make me a spammee?

Member Avatar for vegaseat
20
18K
Member Avatar for Brandon500

Use an initialized list variable, `ListTotal = []` then use append in your loop: `ListTotal.append(int(i))` to put each newly converted int number in the list. Instead of running another loop to sum things, do it as you go with another initialized variable: `v_Sum = 0` and then after the list …

Member Avatar for BustACode
1
1K
Member Avatar for AutoPython

Coincidentally how to do a multi-input was rattling around my head for the past two weeks. Tonight, I click on turtorials for S & G, and bam!, there's the answer. Thanks.

Member Avatar for 111100/11000
6
569
Member Avatar for BustACode

Needed a func to convert base 2 into 10, and back. Found the referenced code in this func for moving between three bases, and generalized it to between bases 2 and 62, and all in between. Upconvert a number, then down convert, then upconvert again. Go wild, have fun.

0
624
Member Avatar for BustACode

In my quest to learn more regarding programming in Python, I "dissect" a lot of other people's code. While doing this, or writing my own code, I end up with 10's of debug print lines. Things like this: if v_Debug == 1: print("DEBUG - ".format()) # DEBUG If I decide …

Member Avatar for Mark_37
0
270
Member Avatar for BustACode

I, and many others, desired a "switch" keyword in Python. For me it was to a desire to make some of my code more compact and readable, as I often have many user selected options for the code to weed through. So I set off on a journey to figure …

Member Avatar for Mark_37
0
593
Member Avatar for cheeseman125

I know that you are still learning, but you may want to get into the habit of using more descriptive variables. Doing so will make your life much easier later when debugging or months from now when you are trying to figure out how something you wrote works. I know, …

Member Avatar for BustACode
0
240
Member Avatar for BustACode

I needed a random color selector. I found one [here](http://peepspower.com/python-script-to-generate-random-css-colors). I rewrote it to make it more general purpose. "f_GenRandomColor" is the picker. The output is in list form, which should make it suitable for most general applications. "f_HTMLRandomColorChart" is just a way to create an HTML table to test …

Member Avatar for snippsat
2
516
Member Avatar for turntomyleft

For an IDE, I use PyScripter for my Python coding. Just the right mix of highlighting, etc. that I need for my rather basic programs/script. I like the ability to add keyboard shortcuts for code templates. So, as I learn how to do certain things, I add that code as …

Member Avatar for vegaseat
0
761
Member Avatar for BustACode
Member Avatar for BustACode

Allows multiple entries using raw_input. I often have to enter multiple items in my Python programs. I desired an easier way than using a loop(s). Today I discovered a way, and with a few mods made it happen.

1
697
Member Avatar for BustACode

Recently I started teaching teens programming. I use Python for them. An adult approached me and asked if I would teach her. The problem is that she's in her 40s, and hasn't had to think logically or algorithmically since high school, if ever. Scratch/Snap is too basic, and Python, in …

Member Avatar for vegaseat
0
235
Member Avatar for jeffcogswell

Looks great, but having followed Micro$oft since the late 80s, I quiver at any mention of them and anything good, or that I love, in the same sentence. And I do love Python. I have seen M$ buy or get involved with technologies or products only to see those technologies …

Member Avatar for Tcll
3
2K
Member Avatar for BustACode

I just love generators in Python. One of the cool things I found out from [this](http://nedbatchelder.com/text/iter.html) site was that one could send in a value when calling on an active generator. To do so one uses the send() method and a yield like so: "x = yield". The send with …

0
341
Member Avatar for vegaseat

Great stuff. I went through it and saved it for future reference. Great cheat sheet. Thanks

Member Avatar for BustACode
6
929
Member Avatar for BustACode

As a result of my research in number theory I find that I often need to break a number down into its numerical parts while stepping through one divisor to another. I call this process "break factoring," as I am just breaking a number down into parts, and not necessarily …

Member Avatar for vegaseat
1
328
Member Avatar for BustACode

Also because of my work in number theory, I often need to have the root floor and root ceing of a number. This is my function for computing those two numbers from a target number.

Member Avatar for vegaseat
0
452
Member Avatar for BustACode

I do a lot of work in number theory, especially with factors. I often need just the two middle factors from a very long factor list/result, so I created a function that takes a factor list and returns just the middle two, or one, factors. Nothing earth shattering, but I …

Member Avatar for vegaseat
0
373
Member Avatar for BustACode

Instead of using letters as substitutes for playing card suits, I came up with a way to use unicodes to produce the common suits. The following creates the coded needed, makes the deck, and then prints the deck. The printing was the hard part. Is 2.7, and should be 3.0+ …

Member Avatar for fonzali
1
1K
Member Avatar for BustACode

My code and funcs for printing to columns in 2.7 and 3.0+ using print(). I had to relearn column formatting as I moved to using the print() function, and so the follwing is a result. Inspired and partially copied from discussion on [StackOverflow](https://stackoverflow.com/questions/9989334/create-nice-column-output-in-python) def main(): # Main Code v_Data = …

Member Avatar for vegaseat
0
381