Forum: Python 5 Days Ago |
| Replies: 15 Views: 362 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 5 Days Ago |
| Replies: 12 Views: 300 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 6 Days Ago |
| Replies: 1 Views: 225 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 8 Days Ago |
| Replies: 2 Views: 191 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 8 Days Ago |
| Replies: 10 Views: 330 I think this is what you need:
import os
os.startfile('filename.py')
Hope that helps :) |
Forum: Python 12 Days Ago |
| Replies: 6 Views: 281 Cause in line 4 of the program you reset the input to 0!? :P Delete line 4 |
Forum: Python 12 Days Ago |
| Replies: 6 Views: 281 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 13 Days Ago |
| Replies: 11 Views: 319 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 13 Days Ago |
| Replies: 5 Views: 233 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 14 Days Ago |
| Replies: 8 Views: 313 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 14 Days Ago |
| Replies: 5 Views: 233 And also change the like
app.Mainloop()
to
app.MainLoop() |
Forum: Python 14 Days Ago |
| Replies: 8 Views: 313 Okay so you need to just copy the names file into |
Forum: Python 14 Days Ago |
| Replies: 8 Views: 313 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 16 Days Ago |
| Replies: 7 Views: 280 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 16 Days Ago |
| Replies: 5 Views: 265 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 17 Days Ago |
| Replies: 12 Views: 307 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 17 Days Ago |
| Replies: 4 Views: 226 Sooo. What work have you done? Its nice to see a base from which we can help you. |
Forum: Python 24 Days Ago |
| Replies: 8 Views: 248 http://xkcd.com/297/
Sorry, i dont usually link things. But this feels appropriate :) |
Forum: Python 26 Days Ago |
| Replies: 3 Views: 190 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: 298 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 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 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 Views: 251 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: 297 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: 297 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,700 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 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 Views: 247 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: 702 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: 436 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: 439 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: 441 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 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: 373 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 Views: 503 |
Forum: Python Jul 2nd, 2009 |
| Replies: 10 Views: 523 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: 471 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 Views: 503 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: 754 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 Views: 786 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... |