851 Posted Topics
Re: In my experience this error is not the fault of Python 3.3.0 but the fault of your IDE. I have run into a similar problem (prime number function) with the EDITRA IDE, any other IDE like IDLE, PyScripter or ConTEXT does not have a problem. | |
When I run: [code]dec = 255 print hex(dec) [/code]I get 0xff, but I like to get just 'ff' | |
Re: You need to let folks know more about the module Pdf and where you got it from. Google doesn't bring it up. | |
Re: Lambda was introduced to Python from Lisp and allows for easier functional programming. | |
Re: Another option, using Python27 or higher: names = ["Jake", "Ben", "Rob"] surnames = ["Cowton", "Fielding", "Spenceley Jones"] for ix, first in enumerate(names): print("{} {}".format(first, surnames[ix])) ''' output >>> Jake Cowton Ben Fielding Rob Spenceley Jones ''' Using zip() is more elegant and takes care of lists with different length. | |
This code shows how to use a minimum Windows Gui program to display the results of a bubble sort of an integer array. | |
Re: Layout manager grid() will give the same problem that pack() will. Use grid() after you assigned the entry object to a variable name or it will be **None**. Do not use: `enter1 = tk.Entry(root, bg='yellow').grid()` but: enter1 = tk.Entry(root, bg='yellow') `enter1.grid()` | |
Re: Looks like venerable PIL has most of its bugs worked out, the newer Pillow does not. | |
Re: You can follow the progress with a test-print: a = [10, 5, 20, 7, 2] print(a) print('-'*44) # start with an empty list b = [] for i in range(len(a)): # take the minimum value of list a and append it to list b b.append(min(a)) # take the value you … | |
Re: You might look at the Python module **sunau** | |
Re: I would keep the namespace alive for re.split() since Python has a build-in split() | |
Re: Why should the newlist get updated? It's now a totally different object. | |
Re: Interesting homework, list() and list-comprehension with step=-1 and slicing [ix:] will get you there easily. | |
Re: Notice that the second tuple is a tuple and has a trailing comma, so lst = [('Meat', 'Milk'), ('Cake - Cookie'**,**), ('Apple', 'Orange')] | |
Re: You can make your module give **real** and **complex** solutions. | |
Re: Just a sample: ''' tk_LabelFrame_grid_layout1.py grid layout of frames ''' try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk root = tk.Tk() root.geometry("320x400") frame1 = tk.LabelFrame(root, text="frame1", width=300, height=130, bd=5) frame2 = tk.LabelFrame(root, text="frame2", width=150, height=130, bd=5) frame3 = tk.LabelFrame(root, text="frame3", width=140, height=100, bd=5) … | |
Re: Gribouillis' second method would be my chioce: s = "hello from outer space" print('_'.join(s.split())) ''' hello_from_outer_space ''' | |
Anybody out there that used Python on an Android system? Something like the subset on http://pygame.renpy.org/ | |
Re: There isn't much room to the left, but this will work: from pylab import * axes([0.1, 0.1, 0.71, 0.8]) plot([0,1], [0,1], 'r-', label="line 1") plot([0,1], [1,0.5], 'b-', label="line 2") # legend(loc=(x, y)) legend(loc=(-0.22, 0.45)) title("legend outside the plot area") show() You can also use module threading to keep your program … | |
Re: As long as you can make the program function the way you want. You learn a lot more that way. | |
Re: Posted in the window of a secondhand shop: [QUOTE]We exchange everything - bicycles, washing machies, toys, tools etc. Why not bring your wife along and pick up a wonderful bargain.[/QUOTE] | |
Re: I speak 16 languages, but in most of them only just a few words. | |
Re: To me isinstance(xml_code, str) is clearer. | |
![]() | Re: No lady has ever been offended when I held the door open for her. However, I have never carried one across a mud puddle. |
| |
Re: It should be possible, but would anybody trust the program after a while? I can see a dictionary with lambda functions, that can be pickled to save it. | |
In a blind taste test, judges compared the flavor, consistency, and appearance of ten types of canned beer commonly available in the US. Listed from highest to lowest score achieved, they are: Coors Light, Amstel Light, Bud Light, Natural Light, Tecate, Heineken, Miller Lite, Pabst Blue Ribbon, Miller, Budweiser. Source: … | |
Re: You are calling for the calculation before there are any values for f1 and f2. Also self.ord_lbl should not be created everytime you do the calculation. Study this updated code: #Calculating coefficients of a digital filter #Ishwar 03-02-2013 from Tkinter import * pi=3.1416 #create root window class Application(Frame): """A GUI … | |
Re: I keep switching back and forth between my IPad and my Toshiba Notebook. Now there are smudges on my notebook (does not have a touch screen). | |
Re: You should really use a list of entry boxes. Something like this: ''' tk_entry_loop2.py exploring Tkinter multiple labeled entry widgets and using a for loop to create the widgets ''' from functools import partial try: # Python2 import Tkinter as tk except ImportError: # Python3 import tkinter as tk class … | |
Re: You really should post this on the Java forum. | |
Re: For the best pictures I would recommend a Hasselblad H3D-39II | |
Re: Find the latest release at: http://sourceforge.net/projects/numpy/files/NumPy/1.7.0rc1/ | |
Re: Don't you feel sorry for the fellows that have to write Java? | |
Re: I am lost with your explanations. | |
Re: Read on DaniWeb: "Oh my giddy aunt, computer language is more baffling than bloomin French!!" | |
Re: The above snippet was a little dated so I modified it to run on Python27 and Python32: # experimenting with Python's list # tested with Python23 vegaseat 21feb2005 # modified via 2to3.py utility to work with Python3 # case insensitive sort has been updated # import module os for method … | |
Re: Hint, your matrix will be a list of 3 sublists, each sublist has 4 elements. matrix34 = [ [2.5, 3.0, 4.0, 1.5], [1.5, 4.0, 2.0, 7.5], [3.5, 1.0, 1.0, 2.5] ] Each sublist forms a row and each column has matching index number elements from each sublist. The index is … | |
Re: What version of PyGame are you using? I tried the changes and they work with PyGame version 1.9.2 You can black out the old screen with screen.fill((0,0,0)) | |
Re: What was your mistake? Maybe others can learn from this. | |
Re: Wow snippsat, what does sum() do here? I thought it would just add up numbers in a list. | |
The other evening I was visiting my great grandpapa in the old folks home. The TV was running, and we both got captivated by a program on the History channel. It talked about the Mayan calendar and that it abruptly ends in 2012. The winter solstice to be exact. That … | |
Re: If you don't put a space around the equal signs, code is hard to read. QMainWindows has its own layout management, read up on it! | |
Re: http://stackoverflow.com/questions/11746766/flood-fill-algorithm-python |
The End.