15,185 Topics
| |
Hi, I am trying to extend my "Student with the best GPA" program so that it allows the user to sort a file of students based on gpa, name, or credits. The program needs to prompt for the input and output files and also the field to sort on (gpa, … | |
I am having a problem getting my "break" to work correctly in this program. Can anyone help me see what I am doing wrong? This is my program: [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): … | |
How can I make a Tkinter window take up all my display screen area? | |
I'm going to have to include a lengthy bit of code, but its every necessary part for you to see what I need. [php]import random availableCountries = range(20) # <--- Used at games start, player's countries taken from here firstTurnsCountries = [] # <--- Player one's country possesion secondTurnsCountries = … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
How can I best center a Tkinter window on my display screen? | |
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/'] … | |
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 … | |
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 … | |
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 … | |
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: … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 = … | |
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, … | |
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 … | |
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 … | |
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 … | |
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 … | |
I want to write a flash player by using python,can someone help me . Thanks a lot. | |
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): … | |
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 … | |
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 … |
The End.