User Profile
Collapse
-
I would like to store the current time and then convert it to military time and then print it on screen. Any help would be great.. -
Military Time
I have a quick question.. How can get python to take whatever time of day it is, and output it as military time? I already know how to get it to return the specific time. -
Code:from graphics import * def main(): win = GraphWin("BMI Calculator", 1200,700) win.setCoords(0.0, 0.0, 3.0, 4.0) ## Draw the interface Text(Point(1,3), " Height (inches):").draw(win) Text(Point(1,3.5), "Weight (lbs):").draw(win) Text(Point(1,1), "Body Mass Index:").draw(win) ht = Entry(Point(2,3), 5)
Leave a comment:
-
-
Here is the code. The Cases (1,2,3,4) has the text that needs to be displayed if the certain condition is met.
Code:from graphics import * def main(): win = GraphWin("BMI Calculator", 1200,700) win.setCoords(0.0, 0.0, 3.0, 4.0) ## Draw the interface Text(Point(1,3), " Height (inches):").draw(win) Text(Point(1,3.5), "Weight (lbs):").draw(win) Text(Point(1,1),
Leave a comment:
-
I am really just using Python v2.5 . I am not supposed to use other gui's. Really, we are just using the graphics .py file to make our gui....Leave a comment:
-
GUI Output Text
I have my gui set up, and I am using a loop to set up output text to be displayed in the gui if the conditions are met. However, what handler do i use to display the text in the gui? -
I am running windows xp with Python v2.5. I also have Activestate Komodo IDE 4.0...Leave a comment:
-
BMI Calculator with GUI
Alright.. I have the basic interface of the Body Mass Index worked out. However, I dont know how to get the feet,inches, and weight to be be multiplied:
Code:(w / (h * 12 + x) * (h * 12 + x)) * 703)
Code:from graphics import * from math import * def main(): win = GraphWin("BMI Calculator", 800, 600) win.setCoords(-2.0, -2.0, 11, 11.5)
-
Copy and Reverse
So far, I have:
from string import *
def reverse():
fname = raw_input("Ente r a Filename: ")
infile = open(fname, 'r')
data = infile.read()
list(data)
print fname[-1:1]
I need python to read the file (whichever the user wants to open), but print it in reverse and save it. I know I need to treat the file as a string, but I am obviously not... -
Code:def display3(): fname = raw_input("Enter a Filename: ") infile = open(fname, 'r') data = infile.read() print data counter = 1 print counter, infile counter +=1
"1 <open file 'auston', mode 'r' at...Leave a comment:
-
Line Numbers
Ok, lol.. I am back again. How can I get python to print line numbers if i have python already loading text from a .txt file. I just need it to print out the line numbers with the text that it is importing and printing. -
Hey, Thanks y'all... Y'all have been a tremendous help in such a short time..Leave a comment:
-
My exact requirement is:
Write an interactive program Copy() that makes a copy of a
file. It should prompt the user for the name of the existing file
and then name for the new file that will be created. The new
file should be an exact duplicate of the original.Leave a comment:
-
So what I need to figure now is for the program to prompt for the file
raw_input("What is the original file: ")
raw_input("What is the new name: ")
Which I know how to do, just not in this sense. But thanks for the original response so quickly, I do understand what that code does, I just dont know how to insert the about code to work. So if anyone can help with this conundrum, I would appreciate...Leave a comment:
-
Nevermind, I got it working, but I can't figure out how to write it as a .txt instead of a file.
*************** *************** *************** *************** ********Code:def copy(): fIn = open(r"auston") # use raw strings for windows file names name= raw_input("Enter the new file name: ") fOut = open(name, "w") for line in fIn: fOut.write(line)
Leave a comment:
-
Cool, thanks.. Maybe its just me, but I do understand your code, however, I can not figure out how to insert a line where the user can enter the name of the new file.. But I will work on it. I really do appreciate your help.....Leave a comment:
-
copy and rename a file
Hey,
I have a problem. I was presented a problem where I need to open a file and then copy and rename it. We are still using really basic commands, but I am pretty lost with this. I know how to open a file and get python to read it. Any help would be great.
No activity results to display
Show More
Leave a comment: