Search Results

Showing results 1 to 40 of 227
Search took 0.02 seconds.
Search: Posts Made By: Paul Thompson
Forum: Python 6 Days Ago
Replies: 15
Solved: Scorecard
Views: 384
Posted By Paul Thompson
Isnt it possible that you could just have two large buttons side to side? When you click them you can set the label (if you are using wxPython) via wx.Button.SetLabel("Label Here") Then you can bind...
Forum: Python 7 Days Ago
Replies: 12
Solved: auto-update?
Views: 314
Posted By Paul Thompson
Why dont you just have it that it reads the first line of project1 and that can have a simple string telling you what version it is. Then if there is a newer one replace

Have this as the first...
Forum: Python 8 Days Ago
Replies: 1
Views: 237
Posted By Paul Thompson
Please post the code that you have written, or a specific problem that you have. We are *not* here to do your homework
Forum: Python 9 Days Ago
Replies: 2
Views: 201
Posted By Paul Thompson
We can fix that with one character, a lowly comma :)
If you put the comma after the print statement it should work

for x in range(1, len(depend)):
#comma after the whole statement
print...
Forum: Python 9 Days Ago
Replies: 10
Views: 340
Posted By Paul Thompson
I think this is what you need:

import os
os.startfile('filename.py')

Hope that helps :)
Forum: Python 14 Days Ago
Replies: 6
Solved: While loop
Views: 286
Posted By Paul Thompson
Cause in line 4 of the program you reset the input to 0!? :P Delete line 4
Forum: Python 14 Days Ago
Replies: 6
Solved: While loop
Views: 286
Posted By Paul Thompson
Okay, so look at your sentence just here:


That tells you exactly what you need to do, first: Ask the user for the current population
This is done with just an input statement

#designed for...
Forum: Python 14 Days Ago
Replies: 11
Views: 327
Posted By Paul Thompson
Steve's code is almost right :)
The problem is in line 5

line.replace('.','')

The problem with that is that it doesn't store the new string in the variable automatically, so just add a line = ...
Forum: Python 15 Days Ago
Replies: 5
Views: 237
Posted By Paul Thompson
All that the .pyw extension does that the .py doesn't is make that black window "python.exe" not show up, which is useful for wxPython apps, sometimes :P
Forum: Python 15 Days Ago
Replies: 8
Views: 316
Posted By Paul Thompson
Okkay. Then what i would do is rather than just saying

open("names.txt")

I would do the full address of where i put the file so

open(r"C:\Program Files\Wing IDE 101...
Forum: Python 15 Days Ago
Replies: 5
Views: 237
Posted By Paul Thompson
And also change the like

app.Mainloop()

to

app.MainLoop()
Forum: Python 15 Days Ago
Replies: 8
Views: 316
Posted By Paul Thompson
Okay so you need to just copy the names file into
Forum: Python 16 Days Ago
Replies: 8
Views: 316
Posted By Paul Thompson
Could you post the exact error? That can help a lot.

As well there are a few things you need to address.


def name_list():
infile = open('names.txt', 'r')
names = infile.readlines()...
Forum: Python 17 Days Ago
Replies: 7
Views: 283
Posted By Paul Thompson
You can find out how something is make up by using the dir() function.

This lists all of the variables, methods and classes of whatever you put inside the brackets :)
Forum: Python 17 Days Ago
Replies: 5
Views: 277
Posted By Paul Thompson
Well you can use the type() function to show what type the number is:

>>> type(12)
<type 'int'>
>>> type(12.4)
<type 'float'>
>>> type(input())
12
<type 'int'>
>>> type(input())
Forum: Python 18 Days Ago
Replies: 12
Solved: pizza delivery
Views: 312
Posted By Paul Thompson
If you are using python 3 then you just have to change your input and print statements to fit

order=int(input("Please enter the price of the order: "))
x=1.50
if order <10:
print("the total...
Forum: Python 19 Days Ago
Replies: 4
Views: 228
Posted By Paul Thompson
Sooo. What work have you done? Its nice to see a base from which we can help you.
Forum: Python 25 Days Ago
Replies: 8
Views: 252
Posted By Paul Thompson
http://xkcd.com/297/
Sorry, i dont usually link things. But this feels appropriate :)
Forum: Python 27 Days Ago
Replies: 3
Views: 190
Posted By Paul Thompson
If you want to write something at the start of a file though you would need to do something like this

#opening the file in read ("r") mode
f = open("file.txt",'r')
#get all that is in the text...
Forum: Python Oct 20th, 2009
Replies: 6
Views: 300
Posted By Paul Thompson
A static method is one that can be called without instantiating the class
so

>>> class T(object):
def test():
print "HI"


>>> T.test()
Forum: Python Oct 17th, 2009
Replies: 7
Views: 456
Posted By Paul Thompson
Yes, i think that is what they are trying to do, but at daniweb we try to not give outright answers for the questions and rather steer users in the right direction so that they may learn by...
Forum: Python Oct 17th, 2009
Replies: 7
Views: 456
Posted By Paul Thompson
Have a fiddle around with

count = 0

while count <= len(s)+2:
count +=1
print '*'

That should print out that right amount of asterisks. See if you cant take that a bit further :)
Forum: Python Oct 15th, 2009
Replies: 5
Solved: Constructors
Views: 251
Posted By Paul Thompson
If you want a book that explains it all really nicely, and is free then have a look at Dive into Python:

FOR PYTHON 2.*
http://diveintopython.org/toc/index.html

FOR PYTHON 3.*...
Forum: Python Oct 15th, 2009
Replies: 5
Views: 298
Posted By Paul Thompson
If by unparsed HTML via script you mean get the source code for a page. Then you do that by using urllib

import urllib

#This is a file like object.
data = urllib.urlopen("www.daniweb.com")
...
Forum: Python Oct 14th, 2009
Replies: 5
Views: 298
Posted By Paul Thompson
have a look at Beautiful Soup (http://www.crummy.com/software/BeautifulSoup/):

I have heard that it is an excellent tool for scraping webpages.

If that doesn't work then you can always try...
Forum: Python Sep 23rd, 2009
Replies: 45
Views: 2,727
Posted By Paul Thompson
It shouldn't be to hard, have a look at the API for the wx.TextCTRL
http://www.wxpython.org/docs/api/wx.TextCtrl-class.html
One of the functon is GetValue() that returns a string of the value in...
Forum: Python Sep 15th, 2009
Replies: 14
Views: 489
Posted By Paul Thompson
Yeah as he said, wxPython has not been made for python 3.
The versions that have wxPython support are:

Python 2.4
Python 2.5
Python 2.6


So personally i do not use python 3 for the...
Forum: Python Sep 14th, 2009
Replies: 3
Solved: making graphs
Views: 248
Posted By Paul Thompson
Yeah i definitely agree. Matlibplot is great.
Here is a simple tutorial for you to start out :)
http://matplotlib.sourceforge.net/users/pyplot_tutorial.html

Oh and this is where you download it...
Forum: Python Sep 7th, 2009
Replies: 2
Views: 712
Posted By Paul Thompson
No. Because its hard to read code (especially python) without code tags

import re

infileName1 = raw_input("Enter filename ")
infile1 = open(infileName1, 'r')
data1 = infile1.readlines()...
Forum: Python Aug 10th, 2009
Replies: 11
Views: 443
Posted By Paul Thompson
In every class in the __init__ method you have to put

threading.Thread.__init__(self)

Without this threading with classes just dosent work properly.

So for example

import threading
Forum: Python Aug 2nd, 2009
Replies: 9
Views: 441
Posted By Paul Thompson
If your on windows there is a great way to tell what a process is. I cant quite remember how to do it on a *NIX system. But you go CTRL+ALT+DEL and then go to the processes tab, you will see a whole...
Forum: Python Jul 10th, 2009
Replies: 5
Views: 444
Posted By Paul Thompson
Your code has a couple of issues, if i am not wrong it will not actually start using threading with your code as it is. You need to add a couple of lines

class Thread ( threading . Thread ):
...
Forum: Python Jul 6th, 2009
Replies: 7
Views: 431
Posted By Paul Thompson
def eliminate( grid, square, value ):
row = square[ 0 ]
col = square[ 1 ]
poss = grid[ row ][ col ]
if len( poss ) > 1:
poss.remove( value )
grid[ row ][ col ] =...
Forum: Python Jul 6th, 2009
Replies: 6
Views: 374
Posted By Paul Thompson
Well you can write a tab by using the escape character and t. So if you were writing a tab to a file you would go something like this:

f = open("File.txt",'w')
f.write("\t This will be indented...
Forum: Python Jul 3rd, 2009
Replies: 12
Solved: wxPython Error
Views: 503
Posted By Paul Thompson
ooh my bad :S.
Forum: Python Jul 2nd, 2009
Replies: 10
Views: 531
Posted By Paul Thompson
what i would do is read the whole file into one list, then you can do something like:

#open it, it is automatically in read mode
f = open("dnalookingfile.txt")

#get a list with all the lines...
Forum: Python Jul 1st, 2009
Replies: 7
Views: 472
Posted By Paul Thompson
Yeah, i dont know if you may have checked this. But i know i stuffed this up one time, but are you sure its .jpeg not .jpg or .JPG or something like that?

:P
Forum: Python Jun 30th, 2009
Replies: 12
Solved: wxPython Error
Views: 503
Posted By Paul Thompson
self.Bind(wx.EVT_MENU, self.Close(), id=ID_FILE_QUIT)

Theres ya problem!
You dont need to put the brackets after self.Close, the brackets are only used if you actually want to call the function,...
Forum: Python Jun 28th, 2009
Replies: 7
Views: 758
Posted By Paul Thompson
I always use the wxPython api when i want to find something out, its a very very useful skill to be able to do that, because of the lack of documentation you really have to try and use what you do...
Forum: Python Jun 28th, 2009
Replies: 17
Solved: python os?
Views: 789
Posted By Paul Thompson
Yeah i agree, i think the best that you could do was boot into windows or something and then just start you new 'python OS' being a fullscreen gui that can do things that you want it to.
But as for...
Showing results 1 to 40 of 227

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC