Forum: Python 3 Days Ago |
| Replies: 3 Views: 157 Note the form of this
[1, 0.1, 0.2, 0.3]
[0, 1, 0.4, 0.5]
[0, 0, 1, 0.6]
[0, 0, 0, 1]
that is, part one =
[1 ]
[0, 1 ]
[0, 0, 1] |
Forum: Python 3 Days Ago |
| Replies: 1 Views: 179 The short answer is to look at QLineEdit here http://www.devshed.com/c/a/Python/PyQT-Input-Widgets/ More tutorials are on the wiki http://www.diotavelli.net/PyQtWiki/Tutorials |
Forum: Python 3 Days Ago |
| Replies: 15 Views: 360 I don't think that anyone here is going to give you code that you can take to another forum, claim it is yours, and ask them to finish it for you. Let this thread die. |
Forum: Python 3 Days Ago |
| Replies: 13 Views: 298 I would suggest two classes, one that handles the physical details of the SQL database and one for everything else. So, if you want to modify a record, the second class would generate a GUI to ask... |
Forum: Python 3 Days Ago |
| Replies: 1 Views: 155 if clickx>=iris1x and clickx <=iris2x and clicky>=iris1y and clicky<=iris2y:
If you are dealing with eyes, etc. that are circles then your test doesn't work. I think you would have to
1. take the... |
Forum: Python 3 Days Ago |
| Replies: 4 Views: 179 If you can call/execute external programs, then you can put each routine in a function in a separate file with the appropriate return value. Otherwise, you could do something like the following to... |
Forum: Python 3 Days Ago |
| Replies: 3 Views: 157 You are using corr as both a list and a function. You'll have to rename one of them. |
Forum: Python 4 Days Ago |
| Replies: 4 Views: 296 A quick example of a spiral using deque. It still has a few problems (works best with a square and prints too many) but shows the general concept. from collections import deque
... |
Forum: Python 5 Days Ago |
| Replies: 15 Views: 360 Start by asking the player(s) for a name and store it in a dictionary that will also keep track of their score. Then, open one graphic window that will simply display the name and score of the... |
Forum: Python 6 Days Ago |
| Replies: 3 Views: 235 Thanks for posting back. I've saved the link as someone else will probably ask this again. |
Forum: Python 6 Days Ago |
| Replies: 2 Views: 147 I don't have much experience with this, so only have used ps to a file and parse the file when this is necessary. This may require some tweaking.def ps_test():
fname = "./example_ps.txt"
... |
Forum: Python 7 Days Ago |
| Replies: 2 Views: 137 It is easier to code than to explain. This will only work if you use a fixed width font. A proportional font would require more work. It is a little bit tricky in that you want to print one... |
Forum: Python 7 Days Ago |
| Replies: 10 Views: 450 if "EMERGENCY" or "Help" or "!" in heading:
pass
elif ("no idea" in body) or (not Code() in body):
pass |
Forum: Python 8 Days Ago |
| Replies: 3 Views: 305 A dictionary may be a better container than a list of lists. If you give each square a unique number, from 1-81, then the neighbors are simple to find.
square -1 and +1 for this row
square -9 and... |
Forum: Python 8 Days Ago |
| Replies: 3 Views: 180 Generally, the structure is more like this. import time
count = 0
PrevTime = time.time()
while count < 1000:
count +=1
print ("It took ", time.time() - PrevTime)
raw_input() Using... |
Forum: Python 8 Days Ago |
| Replies: 2 Views: 223 I think you could check for a number in the second position, if I understand correctly that overlays use numbers and updates/adds use a letter. if len(line.strip()) and \
not... |
Forum: Python 8 Days Ago |
| Replies: 3 Views: 235 So you are obviously using PyQT4 built for Python 2.6. The error message confirms it. Ask how to install PyQT for both 2.6 and 3.x on the Ubuntu or PyQt forum. Some one has done this and if there... |
Forum: Python 8 Days Ago |
| Replies: 2 Views: 218 base = Rectangle(p1,p2)
Can you draw a rectangle with only 2 points? The simple way to do this is to have the house rectangle on the horizontal (set both x values to the same integer), then you... |
Forum: Python 10 Days Ago |
| Replies: 2 Views: 202 A Google coughed up pyq, a download for quotes from Yahoo, and there are sure to be others. This question would probably get more answers on a trading forum, as this one is for coding only. |
Forum: Python 10 Days Ago |
| Replies: 4 Views: 247 Python does not have static variables, but does have global variables, which those are not. They are class objects and would be called using
Atom.cartesian
both inside and outside the class. In... |
Forum: Python 11 Days Ago |
| Replies: 4 Views: 247 You have both class instances and class objects. The variables
cartesian = dict()
bondList = list()
atomName = str()
atomicNum = int()
would point to the same variable (block... |
Forum: Python 11 Days Ago |
| Replies: 6 Views: 280 That's called string formatting http://www.python.org/doc/2.5.2/lib/typesseq-strings.html (assuming you are using Python 2.5). A simple example: year = 1
pop = 12345
for x in range(2):
print... |
Forum: Python 11 Days Ago |
| Replies: 1 Views: 169 For starters, you can use one function to do the output. Also, store the output strings in a dictionary. You can then use a for loop to go through the
if intFCITC_list[0-->10]<0:
and send the... |
Forum: Python 15 Days Ago |
| Replies: 15 Views: 505 Because every row is the same block of memory = fieldb
for i in range(columns):
fieldb.append('.')
for i in range(rows):
fielda.append(fieldb)
#
# These will all be the same because... |
Forum: Python 15 Days Ago |
| Replies: 6 Views: 326 You really should consider using a class for this. Otherwise it gets real convoluted real fast. If you want some assistance, post back. |
Forum: Python 15 Days Ago |
| Replies: 6 Views: 376 You should use this with a try/except (within is while) since anyone would enter more or fewer characters at some time. |
Forum: Python 16 Days Ago |
| Replies: 3 Views: 280 I would assign a unique number to each character that makes up a maze. Then you can find S(tart) and proceed in whatever direction there is an space, keeping track of the path taken so you try ... |
Forum: Python 16 Days Ago |
| Replies: 16 Views: 411 Agreed. You should do your own research from here. Especially since you are just going to forget most of this anyway. Herb Schildt was the consensus guru when this was commonly done, so if you can... |
Forum: Python 17 Days Ago |
| Replies: 16 Views: 411 If you wanted to draw a box on the screen and display some sort of message, you would have to access the memory on the video card. Before toolkits like Tkinter that is the way it was done. In... |
Forum: Python 18 Days Ago |
| Replies: 2 Views: 187 Use the min function to find the smallest number. Is it just me, or is there one person with 100 different ID's who posts every homework problem here, saying they don't have a clue==don't even try. ... |
Forum: Python 20 Days Ago |
| Replies: 1 Views: 178 88282440 PKD0
Test that the first byte is a digit, split on the space if true, and test that the second element starts with a "P", then print everything that starts with a "D" that follows if I... |
Forum: Python 21 Days Ago |
| Replies: 7 Views: 219 Try this and then go to the page from the earlier link which explains why you returned a tuple. def junk(f):
d1 = {}
d2 = {}
for line in f:
columns = line.split(":")
... |
Forum: Python 21 Days Ago |
| Replies: 1 Views: 370 You would probably have to use a large grid with squares, like a large tic-tac-toe board, with a unique number for each square . Also, if you store what the square is, a wall or open space, then you... |
Forum: Python 21 Days Ago |
| Replies: 7 Views: 219 First you are not returning a dictionary. I've added a print statement to show that. Also, take a look at "returns" and "arguments" here http://www.penzilla.net/tutorials/python/functions/ for the... |
Forum: Python 21 Days Ago |
| Replies: 2 Views: 270 It is generally done with a list. def test_input(input_str):
accept_list = []
for x in range(0, 10):
accept_list.append(str(x))
accept_list.append("d")
accept_list.append("r")... |
Forum: Python 21 Days Ago |
| Replies: 1 Views: 149 That is usually a directory problem, i.e. it can't find something because it is not in the current directory. For this line, give it the absolute path name
tune =... |
Forum: Python 22 Days Ago |
| Replies: 5 Views: 414 It should be simple with Python's gstreamer interface. http://pygstdocs.berlios.de/ |
Forum: Python 22 Days Ago |
| Replies: 16 Views: 363 Not enough info for anyone to help (could be an indentation error, or could be in the calcs). First add some print statements for the individual calcs to isolate the error, and post the specific... |
Forum: Python 22 Days Ago |
| Replies: 7 Views: 224 Do you have to use something like queue_draw() to update the widget? The pygtk.org site has been down for 2 days now, so can't look it up, but try it and see.
Just write a simple program using... |
Forum: Python 23 Days Ago |
| Replies: 8 Views: 248 finderGuess = finderGuess - ((((finderGuess*((1+finderGuess)^numberMonths))/(((1+finderGuess)^numberMonths)-1))-
(monthlyPayment/loanAmount))/(((((1+finderGuess)^numberMonths)-1)
... |