15,181 Topics

Member Avatar for
Member Avatar for chris99

My program won't read the listbox correctly. The output from the print statements are as follows: [QUOTE]Dronfield Sheffield 2.20 ('1',)[/QUOTE] I want the list item "B-line" to = 1, but due to the wierdness of the value, it reads it as ('1',) It is meant to read from the passinfo.txt …

Member Avatar for chris99
0
1K
Member Avatar for mattyd

My current GUI program, in part, will display a button which the user may choose to press (or not, in some cases): [code] btn1 = Button(root ,bg="Black", text="HIT", image=image01,command=show_image2) btn1.configure(state=NORMAL,background='red' ) btn1.pack() [/code] This is basic and works fine. The issue I am having is that after the button is …

Member Avatar for mawe
0
3K
Member Avatar for trihaitran

My *.py script has some non-ASCII characters in comment lines and when I run it I am getting the following warning: sys:1: DeprecationWarning: Non-ASCII character '\xe5' in file /Users/haitran/Documents/Sophomore UCB/Python/cedict.py on line 118, but no encoding declared; see [url]http://www.python.org/peps/pep-0263.html[/url] for details The thing is I went to the indicated page …

Member Avatar for trihaitran
0
155
Member Avatar for babutche

Hello, I am trying to create a program that uses a dictionary to associate American states with their capitals. It has an interactive loop that exits when the user enters "quit". The user types the name of the state and the program responds with the state's capital. I will show …

Member Avatar for babutche
0
6K
Member Avatar for ribot

Hello! I'm trying out the python irclib and it's working fine. I have noticed that when I run my program there is a text cursor displayed under the outputs from print. I can print text there and nothing happens. I wonder how I can use this printed text in my …

0
84
Member Avatar for sneekula
Member Avatar for Ene Uran
0
13K
Member Avatar for wandie

I have made a list of names and everytime i want to select a value in the listbox it should give me a result in the Entry box can someone please help me. This is my listbox values [code] musicfolder = [ ["CollegeRock/"], ['RnB/'], ['HipHop/'], ['Build/'], ['Buy/'], ['Techno/'], ['Jazz/'], ['Classic/'] …

Member Avatar for wandie
0
5K
Member Avatar for mattyd

Simply, I need to understand the basics of button binding. I have researched [URL="http://www.pythonware.com/library/tkinter/introduction/events-and-bindings.htm"]this[/URL] already and have decided just to ask for instruction. For example, one of the programs I am building currently will require, at a certain point, user input; I want to be able to know when a …

Member Avatar for sneekula
0
91
Member Avatar for Matt Tacular

I have searched google, but found nothing, I'm not even sure if this is what you call it. But in my program I am writing, if someone hits enter by mistake without entering anything, it errors, is there a way to avoid that? Another error that happens is if the …

Member Avatar for bumsfeld
0
183
Member Avatar for babutche

Hi, I cannot figure out why my fib problem is giving me the output below. I just want it to print when the fib is called and the value of n, when it returns and with what value of n, and the return value. This is what I have so …

Member Avatar for babutche
0
124
Member Avatar for babutche

Hi, I am trying to figure out how to print tracing information for Fibonacci numbers. output = Computing fib(4) Leaving fib(4) returning 3 Can anyone steer me in the right direction? This is what I have: [code]import math def fib(n): if n < 3: return 1 while n >= 3: …

Member Avatar for woooee
0
104
Member Avatar for bud594

I seem to have an intermittent issue with the following code segment. I am installing an application which has an associated excel add in which I register and then run the on open macro. The formula then calls one of the functions from the add-in. The script fails at the …

Member Avatar for bud594
0
768
Member Avatar for Matt Tacular

is there an easy way to detect if the entire contents of one list are in another? if I have a list like this: li = [1,2] and I have another which will have random values, I want the program to do something only if every value of li is …

Member Avatar for vegaseat
0
168
Member Avatar for mattyd

Hello: [I]** I have been researching and experimenting with this with tutorials from many sources but can not even begin it to get it to work it seems.[/I] I have a very small yet important Python program that I must make into an executable file within a week's time or …

Member Avatar for vegaseat
0
277
Member Avatar for babutche

Hi Everyone! I need a little help with this problem. I am trying to import a class -- Student with object makestudent but I keep getting this error: [CODE]This program sorts student grade information Enter the name of the data file: p2sortin.py Traceback (most recent call last): File "C:\Python23\p2sort.py", line …

Member Avatar for Ene Uran
0
136
Member Avatar for babutche

This is what I have come up with but it seems like there should be a more simple way of programming it. [CODE]import string import math class Student: def __init__(self, name, hours, qpoints): self.name = name self.hours = float(hours) self.qpoints = float(qpoints) def getName(self): return self.name def getHours(self): return self.hours …

Member Avatar for babutche
0
116
Member Avatar for jrcagle

Hi all, I know there have been several threads about getting card images into a GUI, but I'm flustered trying to understand why some things work and some things don't. Here's the code: [php] import random from Tkinter import * import Image, ImageTk class Card(object): suits = ["C","D","H","S"] values = …

Member Avatar for vegaseat
0
2K
Member Avatar for babutche

Help! I am trying to enter characters (for classroom grades) into my program and convert them to numeric values so I can get gradepoint averages. I can't figure out how to convert A-, A+, B-, B+, etc... Can someone help? This is what I have: [code]class Student: def __init__(self, name, …

Member Avatar for babutche
0
125
Member Avatar for trihaitran

Hi I'm a completely new to computer programming and am looking to make an application that can search through 3 dictionaries using one input. The dictionaries are Chinese-English, Chinese-Vietnamese and another Chinese-English. The first one is taken from CEDICT, an open source dictionary in Unicode. I'm going to try to …

Member Avatar for vegaseat
0
153
Member Avatar for babutche

HI, I HAVE BEEN TRYING TO FIGURE THIS PROBLEM OUT ALL DAY LONG. CAN SOMEONE PLEASE HELP ME ALONG? I WILL TELL YOU THE PROBLEM AND THEN SHOW YOU WHAT I HAVE SO FAR. I AM TRYING TO MODIFY THIS RECURSIVE PROGRAM: [code=python] def fib(n): if n < 3: return …

Member Avatar for jrcagle
0
108
Member Avatar for chris99

Just trying to make pickle work, but when I load the file the dictiionary is still empty. It's an addressbook, with the dictionary keys being names, and values being numbers {N:NUM} I've programmed pickle to save it to a file with a user specified name, and it does so. I …

Member Avatar for vegaseat
0
129
Member Avatar for lockettpots

Hi all My first time with this forum:). I'm running python 2.4.4 and unicode enabled wxPython on Windows XP. I'm writing a gui application which requires users to be able to type accented characters easily into a TextCtr. To this end I have built a set of tools on a …

Member Avatar for lockettpots
0
97
Member Avatar for seasou
Member Avatar for seasou
0
2K
Member Avatar for babutche

O.K. This is what I have changed in my [URL="http://www.daniweb.com/techtalkforums/thread65045.html#"]program[/URL]: import string import math class Student: def __init__(self, name, hours, qpoints): self.name = name self.hours = float(hours) self.qpoints = float(qpoints) def getName(self): return self.name def getHours(self): return self.hours def getQpoints(self): return self.qpoints def gpa(self): return self.qpoints/self.hours def addLetterGrade(self, LetterGrade, credits): …

Member Avatar for babutche
0
177
Member Avatar for jrcagle

Hi all, In the never-ending quest to master Tkinter, I wrote a small version of Notepad. Here is my "SaveAs" function: [php] def save_as(): if not mainw.filename: mainw.filename = tkFileDialog.asksaveasfilename(title="Save As...", filetypes=[("All Files","*.*"),("Text Files","*.txt")]) if not mainw.filename: return f = open(mainw.filename, "w") s = mainw.frame.edit.get("1.0",END) f.write(s) f.close() [/php] As you …

Member Avatar for Ene Uran
0
89
Member Avatar for babutche

Hi, I need help please. At first I was understanding the Python language but I got lost somewhere along the line. Can someone please guide me through implementing an addLetterGrade method? I am not very good with computers and I am having a very hard time. This is my first …

Member Avatar for babutche
0
200
Member Avatar for Matt Tacular

[php] import random availableCountries = [0, 1, 2, 3, 4, 5, 6, 7] firstTurnsCountries = [] secondTurnsCountries = [] def countryDivider(countryNum): counter = 0 while True: if counter == 8: break num = 7 if num > 0: countryToAdd = random.randint(0,num) if num == 0: countryToAdd = 0 if counter …

Member Avatar for Matt Tacular
0
110
Member Avatar for sneekula

I like to create a database of common chemicals with Python. How would I go about that? Any help welcome!

Member Avatar for Ene Uran
0
115
Member Avatar for sneekula

This came up on Chris99's bus ticket program thread. Would like to see any simple examples on how to pass variables between classes without using global variables.

Member Avatar for vegaseat
0
19K
Member Avatar for chupacabra

python 2.4.1 mySQLdb 1.2.0 kernel 2.6.12 Hi, How can I make the following statement so I can search for any string? Right now I need to input at runtime %whatever I'm looking for% between % signs to get all records matching that query. I want to have this statement set …

Member Avatar for locosway
0
134

The End.