14,946 Topics

Member Avatar for
Member Avatar for butterflyTee

[CODE]# tpm.py # Take two inputs, age and years of citizenship, and returns eligibility for # senator and representative. from graphics import * def main(): win = GraphWin('Eligibility' , 400,400) win.setCoords(0.0,0.0, 4.0, 4.0) Text(Point(1, 3.0), 'Age').draw(win) Text(Point(1, 2.0), 'Years Citizen').draw(win) agebox = Entry(Point(2, 3.0), 10) agebox.draw(win) citizenshipbox = Entry(Point(2, 2.0), …

Member Avatar for butterflyTee
0
112
Member Avatar for johnhl007

Ok i am having a little trouble trying to figure out how to pull the x-cordinate from p1 and p2 so that i can use it later in the code to build a door. # This is a program to build a house in five clicks from graphics import * …

Member Avatar for Scagli3tti
0
454
Member Avatar for butterflyTee

# tpm.py # A program that accepts the total amount of purchase, calculates the # appropriate discount, and displays the discount and the purchase after # discount. from math import * def main(): cost = get_cost() discount = get_discount() % = calc_percent(discount) final cost = get_final_cost cost_percent = cost_discount(cost, discount) …

Member Avatar for butterflyTee
0
107
Member Avatar for a1eio

Hi, I've got a small program, that would be really useful if it could stay on top of other windows programs, i don't think there is a method for that in Tkinter, if anyone has any experience or ideas on this topic, please let me know thanks

Member Avatar for a1eio
0
22K
Member Avatar for thare

I've heard the word "Literal" many times in Python But I don't understand it ! what does this mean ? Thanks ! :rolleyes:

Member Avatar for vegaseat
0
112
Member Avatar for bumsfeld

I need to know how many times my function has been accessed in my program. Any suggestions other than global variable?

Member Avatar for vegaseat
0
3K
Member Avatar for G-Do

Hi all, I'm writing a simple MIDI player (which I might eventually turn into a editor, if I feel ambitious). To that end, I've been futzing around with the pygame.mixer and pygame.mixer.music modules. I can get MIDI files to play, but I would also like to be able to grab …

Member Avatar for G-Do
0
264
Member Avatar for butterflyTee

Did I do this right and can you please help me. This program uses a GUI to input a user's first and last name, and construct and display a UserID. Although the program 'runs', there are several problems with it. Fix each of these problems in turn: 1) The text …

Member Avatar for mechdriver
0
170
Member Avatar for python_dev

Hi, i have a program where i use a while loop to create buttons dynamically. Each button is created with, for a label, the name of one the drives on the machine(using the result of the fsutils command). Up to this point everything works fine, if i have drive C: …

Member Avatar for python_dev
0
153
Member Avatar for butterflyTee

# tpm.py Computes the cost per square inch of pizza given cost of the pizza, # and diameter. from math import * def main(): cost_per_square_inch(area_of_pizza()) def area_of_pizza(): diameter = input("Enter the diameter of the pizza: ") radius = 1.0/2.0 * diameter a = pi * radius * radius return a …

Member Avatar for Ene Uran
0
135
Member Avatar for jaafit

Does anyone know how to remove a window's border and title bar in wxPython? I want the client area to fill the entire screen. I have a wxPanel defined as follows: class FlashPanel(wxPanel): *def __init__(self, parent, flashFile): **wxPanel.__init__(self, parent, -1) **sizer = wxBoxSizer(wxVERTICAL) **ActiveXWrapper = MakeActiveXClass(flashControl.ShockwaveFlash) **self.Flash = ActiveXWrapper( self, …

Member Avatar for jaafit
0
1K
Member Avatar for jread

I am trying to create what should be a very simple script, though I'm having a very difficult time getting it to work. All I want to do is create a new copy of a master file once per week and do my work on the copy. I plan to …

Member Avatar for jread
0
254
Member Avatar for Ene Uran

Python uses the directories listed in PYTHONPATH to find a module. How can I assure that the module I am importing is on this list of paths?

Member Avatar for vegaseat
0
168
Member Avatar for Ene Uran

I keep hearing that the eval() function is unsafe. It is a nice function, because you can use it like print eval("2.5*49.7/(23+3.14)") and it will solve the math. Is there any way to protect against some nasty minded person to enter a "os.system(command)" where the command will erase a file …

Member Avatar for Ene Uran
0
101
Member Avatar for Micko

Hello people of Python community, I'm back with (so far) strong will to learn Python, just like you. I remember once, Narue told me that good way to learn different prog. languages is to concetrate on algorithms and data structures and their implementation in language of choice. That way, she …

Member Avatar for Ene Uran
0
534
Member Avatar for JoshBebbington

I have been looking over Vegaseat's Word Count program. I have two thoughts about what I want to configure it to do, but I'm not sure how to go about it. Idea 1; This is most important. I want users to be able to put a text file in the …

Member Avatar for a1eio
0
124
Member Avatar for shafter111

Hi! Thanks for your help in advance..... Heres my case I have a dictionary "d" with keys as string and a dictionary as integer "1" as keys to a list [1,2,3] [code] d{"test.tif": {1: [1,2,3]}} [/code] Now when I try looping through it........it gives me an error [code] for i …

Member Avatar for shafter111
0
144
Member Avatar for shafter111

simple problem....but I have no clue why its not working..... [code] if (w[0] > m[1]): temp = ((w[0]-m[1])/w[0])*100 print temp [/code] For some reason temp is always 0.........I want a double percentage difference between the two values.... Please guys..help me out here......after 500 lines of code ...I am stuck here......my …

Member Avatar for shafter111
0
105
Member Avatar for harini_b

Hi, I've encountered a problem iwhile writing a find and replace prg in python. this is my code: [CODE]import re f = file('testfile') while True: line = f.readline() if len(line) == 0: break print line p = re.compile(line) m = p.match('METASERV_HOME') print m f.close()[/CODE] as per the logic : if …

Member Avatar for pythonguy
0
104
Member Avatar for magnumbi

Hi everyone, I am new to python and programming in general and I could use some help on converting an integer to a decimal (e.g. 80% to .8). Here is what I have so far but as I'm sure you can tell, it doesn't work: [CODE]elif menu_choice == 2: print …

Member Avatar for magnumbi
0
256
Member Avatar for csaha

Hi Python Experts [B]I need to convert a code written on JAVA/JSP (Java Tags are also there inside JSP) to PYTHON. [/B] I have OK kind of knowledge in PYTHON, but dont have a muck knowledge in JAVA/JSP. Any idea how to approach? I am having tough time to achieve …

Member Avatar for G-Do
0
1K
Member Avatar for pythonguy

I am using automation desk to run python scripts. This in tern executes scripts using v2.2 interpreter every time i m trying to use raw_input("Enter name ") it fires EOF Error. If i run it in interpreter separately it works fine.Its really basic functionality. FYI: Automation desk dont support script …

Member Avatar for pythonguy
0
179
Member Avatar for a1eio

i don't understand the use of the os.popen function, i've used it to read things, for example: [CODE] >>> a = os.popen("netstat") >>> for line in a.readlines(): print line Active Connections >>> [/CODE] i understand that, but there is also a buffersize and a write ability, but i've played about …

Member Avatar for vegaseat
0
3K
Member Avatar for bumsfeld

This small program is neat: [CODE]import calendar calendar.prmonth(2006, 3) """ March 2006 Mo Tu We Th Fr Sa Su 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 …

Member Avatar for vegaseat
0
914
Member Avatar for coolman2006

Does anyone know about LISP Programming I am trying to make this program where I have 3 types of cars, which are ford bmw merc ford has focus and fiesta BMW has 1series and 2series and the merc has SK100 and SK200 well basically i am trying to put them …

Member Avatar for vegaseat
0
209
Member Avatar for Blujacker

Hi!I have a problem and i think you can help me!(Sorry my english.I learn just one year) Thats part of my program... [code] okno=Tk() text=Text() text.pack() def find(): print "I need help here" menubar = Menu(okno) editmenu = Menu(menubar, tearoff=0,bd=4) editmenu.add_command(label="Find", command=find) menubar.add_cascade(label="Edit", menu=editmenu) okno.config(menu=menubar) [/code] i need add to …

Member Avatar for Blujacker
0
92
Member Avatar for Ene Uran

I have the following code, for example: [CODE]price = 50.00 tax = price * 0.08 print "Tax = $",tax # Tax = $ 4.0[/CODE] As you can see there is a space between $ and 4.0. Is there a way to avoid this? I haven't done much Python coding.

Member Avatar for vegaseat
0
108
Member Avatar for sharma_vivek82

hi, i am very new in python. can anyone tell me that how to create dynamic dropdown box in python scripting.(triple dropdown box)

Member Avatar for vegaseat
0
789
Member Avatar for butterflyTee

I need help please to write this program. Numerologists claim to be able to determine a person's character traits based on the "numeric value" of a name. The value of a name is determined by summing up the vaules of the letters of the name where 'a' is 1, 'b' …

Member Avatar for alc6379
0
4K
Member Avatar for JabaPyth

For the Tkinter Text widget, is there a way to assign the selected text to a new tag?(other than 'sel',which changes)

Member Avatar for Ene Uran
0
113

The End.