Forum: Python 2 Days Ago |
| Replies: 4 Views: 159 As woooee already mentioned, don't use the Python Shell (has those screwy looking >>> prompts) for writing programs. The Shell is only used for testing small parts of code.
You can modify... |
Forum: Python 4 Days Ago |
| Replies: 3 Views: 186 Which version of Python are you using?
Using Python2 you would use something like this to create an array of names. Generally Python uses lists for arrays.
# create the name list
name_list = []... |
Forum: Python 7 Days Ago |
| Replies: 4 Views: 212 Don't forget to set a and b to zero outside the loop. |
Forum: Python 7 Days Ago |
| Replies: 5 Views: 230 You might want to use bind() rather then the command arg. Take a look at:
http://www.daniweb.com/forums/post1077620.html#post1077620 |
Forum: Python 7 Days Ago |
| Replies: 80 Views: 18,483 Using the Tkinter GUI toolkit, the question of how to detect which button has been clicked comes up often. There are several solutions. The first solution is to use the bind() method that passes an... |
Forum: Python 12 Days Ago |
| Replies: 8 Views: 316 In all fairness to snippsat, he did point out that DaniWeb contains a fair number of well commented PyQT examples to study and experiment with.
As of 08dec2009 we have:
Mainwindow frame ...... |
Forum: DaniWeb Community Feedback 13 Days Ago |
| Replies: 44 Views: 2,097 I think Tom Gunn is an AI system that is down for the switch to Windows 7. |
Forum: DaniWeb Community Feedback 13 Days Ago |
| Replies: 80 Views: 6,538 |
Forum: Python 14 Days Ago |
| Replies: 1 Views: 350 This simple code shows how to write text with a given font, font size and color using the module pygame ... |
Forum: Python 14 Days Ago |
| Replies: 130 Views: 50,656 This code shows you how to create a drawing on a wxPython canvas and save the drawing to a standard image file ...
# use a drawing bitmap and wx.MemoryDC to create a canvas you can
# draw on and... |
Forum: Python 18 Days Ago |
| Replies: 2 Views: 379 Hide the root window with:
root.withdraw()
Bring the root window back up with:
root.update()
root.deiconify()
Remove root window border and title bar with:
root.overrideredirect(True) |
Forum: Geeks' Lounge 20 Days Ago |
| Replies: 62 Views: 2,140 Actually 22/7 is pretty crude. The Chinese Approximation of pi is much better. Simply use 355/113. You can remember this by looking at the first three odd integers written this way 113355. |
Forum: Python 21 Days Ago |
| Replies: 4 Views: 465 This program uses the Python win32 extension module to get information on disk or flash drives for Windows machines. Specify the drive with its letter. If no drive letter is specified, the current... |
Forum: Python 21 Days Ago |
| Replies: 3 Views: 220 Take a look at this recent thread:
http://www.daniweb.com/forums/thread241860.html
were we discussed functions and parameter passing. |
Forum: Python 21 Days Ago |
| Replies: 14 Views: 527 Tkinter is Python's wrapper of the GUI toolkit Tk, originally written in a computer language called TCL. Tkinter has the advantage of a small footprint, also IDLE, the IDE that ships with Python, is... |
Forum: Python 21 Days Ago |
| Replies: 14 Views: 527 Don't overlook the fact that the Python installer you use is specific for the Operating System. If you install Python on a Windows OS, the GUI toolkits will use the Windows GUI. A similar thing... |
Forum: Python 22 Days Ago |
| Replies: 9 Views: 463 You pass variables as need as function arguments and/or returns. |
Forum: Python 24 Days Ago |
| Replies: 9 Views: 463 Here is a rather simple example of a number of functions working together from:
http://www.daniweb.com/forums/post104853.html#post104853
def get_name():
"""this function only returns... |
Forum: Python 24 Days Ago |
| Replies: 7 Views: 459 The function main() can be simplified ...
def main():
while True:
fahrenheit2celsius()
cont = raw_input('Continue converting? (yes/no): ')
if 'n' in cont.lower():
... |
Forum: Geeks' Lounge 24 Days Ago |
| Replies: 8 Views: 569 I am surprised the Klingons had no F. Imagine a language without F words! |
Forum: Geeks' Lounge 24 Days Ago |
| Replies: 31 Views: 2,012 Darn, another meaningless question!
Here I though I would stimulate somebody's thought process. |
Forum: Geeks' Lounge 24 Days Ago |
| Replies: 1,424 Views: 156,512 Two eggs over easy and fried potatoes and onions. A mug of breakfast stout. |
Forum: Python 25 Days Ago |
| Replies: 2 Views: 217 use temp = self.set_greyLevel(grayScale) |
Forum: Python 25 Days Ago |
| Replies: 13 Views: 443 I tend to agree with Gribouillis. As your program grows you can split out some classes in a linear fashion. Later on, as the bugs are worked out, turn them into modules |
Forum: Geeks' Lounge 26 Days Ago |
| Replies: 9 Views: 471 |
Forum: Python 28 Days Ago |
| Replies: 9 Views: 520 I tried the latest version of Eric (4.3.9). It assiste with PyQT syntax, but does not accept the newer connect style used with PyQT 4.5+. Somewhat irritating! |
Forum: Python 28 Days Ago |
| Replies: 2 Views: 250 __str__() does operator overloading in a class and "hijacks" str() in any class instance operation that uses str(). So print crit1 will use it, because it uses str() to make it printable. Whereas... |
Forum: Python 29 Days Ago |
| Replies: 10 Views: 561 I assume the question is:
Who is foolish enough to do my homework for me? |
Forum: Python 31 Days Ago |
| Replies: 6 Views: 319 When you use a.extend(b) or a.sort() then list a is changed, since both are inplace functions. Also when you pass a list to a function argument, be aware that the list is a mutable object and... |
Forum: Geeks' Lounge 33 Days Ago |
| Replies: 1,424 Views: 156,512 Pumpkin icecream (a real treat usually sold around Thanksgiving in the US). |
Forum: Geeks' Lounge 33 Days Ago |
| Replies: 26 Views: 2,144 When the can of frozen Orange juice says "Concentrate" and you do. |
Forum: Geeks' Lounge 33 Days Ago |
| Replies: 1,424 Views: 156,512 Eggs, sunny side up, toasted English muffin with plum jelly. |
Forum: Python Nov 16th, 2009 |
| Replies: 5 Views: 307 Why don't you just run the sample code I gave you with the image_file = "mars.jpg" and make sure you have the image file in the working directory or give it the full path.
Avoid the crap you added... |
Forum: Python Nov 16th, 2009 |
| Replies: 5 Views: 307 Pygame can load quite a number of image formats. Here is an example ...
# experiments with module pygame
# free from: http://www.pygame.org/
# load and display an image using pygame
import... |
Forum: Python Nov 15th, 2009 |
| Replies: 9 Views: 349 Correct. Don't you admire the beauty of Python version changes? Right out of a Monty Python show!
Actually, most computer languages have had their fair share of version changes, they are always... |
Forum: Python Nov 15th, 2009 |
| Replies: 6 Views: 326 You could do something simple like this ...
from graphics import *
import random
def drawCircle(win, centre, radius, colour):
circle = Circle(centre, radius)
circle.setFill(colour)
... |
Forum: Python Nov 13th, 2009 |
| Replies: 11 Views: 543 Back to the original code, this would have made more sense ...
class Player:
"""Enter name as string"""
def __init__(self, playername):
self.name = playername
def... |
Forum: Geeks' Lounge Nov 11th, 2009 |
| Replies: 26 Views: 2,113 Maybe Windows is simply too unsafe for Go.
Actually the syntax looks a lot like a mix of Object Pascal and C++, not sure where the beauty of Python went. |
Forum: Python Nov 11th, 2009 |
| Replies: 14 Views: 595 The nice thing about Xydric's approach is that it doesn't lose the important connectivity with the original dictionary via the keys ...
data = {
'1234': ['Matt', '2.5', 'CS'],
'1000': ['John',... |
Forum: Python Nov 10th, 2009 |
| Replies: 13 Views: 354 When you have a project like this, it is best to test each shape you want to draw before you combine it all. Let's start out with a pygame template that you can use for each shape ...
import pygame... |