15,181 Topics
| |
In the following code I am trying to select a file either from a file chooser or just typing out the path. The problem is I want the comboboxentry to change background color when something is put in it. The code works fine if it's a combobox (Line 7 is … | |
I would like to create a function using the code below called drawMove which takes 2 parameters (x or 0) and square number. That draws an x or 0 in the numbered boxes on the grid below. Input should be: drawMove(turtle,cellsize,O,6) ---> this should draw a O in the 6th … | |
Hey guys, I have a simple numpy datatype: [CODE]spec_dtype = np.dtype([ ('wavelength', float), ('intensity', float) ])[/CODE] I chose to use this in my program because it's very easy to read in 2-column spectral data files using the genfromtxt() method. Therefore, I made a fairly sizable program around this datatype. Now … | |
I am having problems with a GUI I'm working on. The idea is to have a tree list of signals and be able to drag them onto the plot. Eventually having a long list of signals and multiple plots etc.. However the code segmentation faults after a seemingly random number … | |
I am trying to create a function which would take a list and be able to count the number of ints floats and str in that list. output should be: list = ['v', 3.0,1, 'etc'] freq = countDataTypes(list) print(freq) [2,1,1] any help would be greatly appreciated so far: [CODE] >>> … | |
| def fnKey(dic, value): return [k if value == v else pass for k, v in dic.iteritems()] can anyone tell me why this doesn't work? i'm trying to return the key for a known value from a dictionary |
I'm writing a program that checks a txt file with a list of words (one word per line). I'm just this side of done, I think. [CODE]def StripPunctuation(s): answer="" for c in s: if c.islower() or c.isupper(): answer=answer+c.lower() return answer def Reverse(s): answer="" for c in s: answer=c+answer return answer … | |
I am having trouble correcting the syntax on this problem so far and I can't seem to find my mistake any ideas on what I am doing wrong ? The object of the program is to ask user for amount of money to put in the pot, and play until … | |
i have no idea what this means... and i really need help starting my new python web app project... [CODE]root@ubuntu:~# python solif/manage.py syncdb Traceback (most recent call last): File "solif/manage.py", line 14, in <module> execute_manager(settings) File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 438, in execute_manager utility.execute() File "/usr/lib/pymodules/python2.7/django/core/management/__init__.py", line 379, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File … | |
hi, am trying to work this one out for dictionaries. I have this 2 dict that i want to merge. a= {16: {(7, 8, 0): {0: 4, 1: 5, 2: 6, 3: 7}, (7, 7, 0): {0: 0, 1: 1, 2: 2, 3: 3}}, 18: {(7, 8, 0): {0: 12, … | |
I'm trying to use the exec command in python to try to get a function to call on different dictionaries and functions as needs change without making my program bigger than it needs to be. Unfortunately I keep getting this error: File "Game Files\Intro.py", line 214, in Anim exec compile('%slegs … | |
say for example the first 5 apples you buy cost .50 and the next 5 apples you buy after that cost .40 and every apple after that is .30. How would I go about creating a function that could tell okay apples 1-5 cost .50 then add any extra in … | |
Hello, I am a very entry level python user so my knowledge is behind at the moment but I am have a problem creating a function that will take an x range and pass it through as a parameter to my function and output all the results. For example this … | |
Hello, i'm new to python, I mostly program in C++. i'm adding values, but it doesn't give me the right answer. [CODE] x = input("Enter number: "); y = input("Enter a another number: "); z = x + y; print("Answer is: " + z); [/CODE] if i enter 5 + … | |
I have a wx Gui that gathers all the necessary info and starts an external command line app. Whilst it is running my gui freezes as you'd expect so I've been experimenting with putting the external app in a thread of its own. My original code ends with the line: … | |
So im trying to create a times table: Write a program to print a multiplication table (a times table). At the start, it should ask the user which table to print and how high the table should go. The output should look something like this: Which multiplication table would you … | |
Trying to help my brother who has just started learning Python at school. He's not the brightest so any help is appreciated. I consider this quite hard for someone who has barely started, although he has missed a few lessons through illness. Solution is welcome but please try to explain … | |
Hello, I am learning python and am having trouble getting this program to work correctly. [CODE]from Tkinter import* import time import tkMessageBox import random def Questions(): number1 = random.randrange(1,25,1) number2 = random.randrange(1,50,2) answer = number1 + number2 prompt = ("Add " + str(number1) + " and " + str(number2)) label1 … | |
I am new to python and cant figure out what I am doing wrong with the global variables. Here is an example of the problem I am having. number = 0 def test(): global number number = raw_input("Please type a number.") def prints(): global number if number2 != 1: print … | |
I'm probably missing something really obvious, but I downloaded the Python 2.72 release, and now I can't figure out what to do. I've tried googleing it but everything says to just install it. Is that install the setup.py file? If it is, how do I run a python file if … | |
I started making a simple drawing program, to use for a level maker, and I came across a slight issue [CODE]from Tkinter import * class Main: def __init__(self,root): w,h = root.winfo_screenwidth(), root.winfo_screenheight() current = {} canvas = Canvas(root, width = w, height = h, bd=0) canvas.pack() root.overrideredirect(1) root.geometry("%dx%d+0+0" % (w, … | |
Hey i'm trying to place a ship onto my grid but my translation function is trying to iterate over None type, if someone would write a simple horizontal ship placement in translation function i'm sure i can finish the rest, thank you! [CODE]class start(object): def __init__(self): self.GameT = int(raw_input("One Player … | |
[CODE]sizeA = 2**28 M = [0]*sizeA[/CODE] The above code creates an array but, each element is 4 bytes each. How do create a large byte array with type 'B' (eight bits unsigned)? I would like it to be as large as possible. I need it for a sieve prime number … | |
Hi. I have a small dilema. I have 1 Picassa .ini file a contacts.xml file and a few images all in the same folder. On the images there are certian people, picassa.ini file holds the image name and id's of people included on that image in such format: [CODE][img_8538.jpg] faces=rect64(4ac022d1820c8624),d5a2d2f6f0d7ccbc … | |
For school I have to write a program that requests a 3 part name and breaks it into a first, middle, and last name. I wrote the code but the alignment of my output is not right. I was wonderng if someone can tell me what I did wrong and … | |
Hello guys, just joined the community. Found it through google. :) I am basically new to python, only couple of days of knowledge. I am trying to make all the words in a txt file appear in 4 or 5 in a row. so the txt file looks like this: … | |
For school I have to write a program that requests a 3 part name and breaks it into a first, middle, and last name. I wrote the code but the alignment of my output is not right. I was wonderng if someone can tell me what I did wrong and … | |
Hi, Just started learning python..and want to learn to do this I want to read a text file that something like 10000 20000 30000 40000 20000 30000 88888 88888 60000 12333 44431 12345 I want to get the difference of numbers in column1 divided by x, where I want to … | |
(I'm new to programming in general) I created a program in python without an interface and part of it used a raw_input to get a users answer and compare with a stored answer. This was in a loop that limited the number of attempts the user could have. This worked … | |
So, even thou I have searched throughout the forums, I couldn't get a clear answer, maybe perhaps I'm a noob @ Python. As a beginner, I don't know much about Python, and it's frustrating to search the net and not find the actual answer. So, I'm working on this project, … |
The End.