Search Results

Showing results 1 to 40 of 1000
Search took 0.10 seconds.
Search: Posts Made By: vegaseat ; Forum: Python and child forums
Forum: Python 6 Hours Ago
Replies: 5
Views: 133
Posted By vegaseat
def status():
print "\nThe total number of critters is", Critter.total

status = staticmethod(status)

This allows class function status() to be called with the class name...
Forum: Python 7 Hours Ago
Replies: 9
Views: 194
Posted By vegaseat
You pass variables as need as function arguments and/or returns.
Forum: Python 7 Hours Ago
Replies: 3
Views: 110
Posted By vegaseat
If you have Windows you can use this ...
# get disk information on Windows
# using the win32 extension module from:
# http://sourceforge.net/projects/pywin32/files/
# tested on Windows XP with...
Forum: Python 8 Hours Ago
Replies: 3
Views: 215
Posted By vegaseat
And another page ...
http://en.wikibooks.org/wiki/Python_Programming/Email
Forum: Python 1 Day Ago
Replies: 3
Views: 157
Posted By vegaseat
Something like this ...

from Tkinter import *

def exit():
# do cleanup code here
pass

root = Tk()
# respond to window title bar x click
Forum: Python 1 Day Ago
Replies: 9
Views: 194
Posted By vegaseat
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 1 Day Ago
Replies: 6
Views: 197
Posted By vegaseat
The function main() can be simplified ...
def main():
while True:
fahrenheit2celsius()
cont = raw_input('Continue converting? (yes/no): ')
if 'n' in cont.lower():
...
Forum: Python 2 Days Ago
Replies: 5
Views: 171
Posted By vegaseat
To approximate for instance the sine of x (x in radians) you can use the Taylor series expansion:
x - x**3/3! + x**5/5! - x**7/7! + ...

However, to get even a remotely accurate number the cutoff...
Forum: Python 2 Days Ago
Replies: 5
Views: 158
Posted By vegaseat
i was under the mistaken impression that you had to use functions
Forum: Python 2 Days Ago
Replies: 2
Views: 113
Posted By vegaseat
use temp = self.set_greyLevel(grayScale)
Forum: Python 3 Days Ago
Replies: 5
Views: 158
Posted By vegaseat
Ouch!!!!!!!
A couple of hints ...

you still have to start with one function call from main

you need to pass your arguments to and from your functions

variable, function and class names are...
Forum: Python 3 Days Ago
Replies: 195
Read Me: Starting Python
Views: 86,289
Posted By vegaseat
Here is an example of how you can create a C type switch/case construct using a Python dictionary ...
# a simple reverse polish notation calculator

def do_operation(a, b, op):
"""
here...
Forum: Python 3 Days Ago
Replies: 2
Views: 209
Posted By vegaseat
I think there are a number of so called Reverse Polish Notation calculator examples on this forum.
Forum: Python 3 Days Ago
Replies: 1
Views: 220
Posted By vegaseat
You can write a small Python utility program to do that for you!
Forum: Python 3 Days Ago
Replies: 13
Views: 297
Posted By vegaseat
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: Python 3 Days Ago
Replies: 15
Solved: Scorecard
Views: 357
Posted By vegaseat
For old stuff like that I recommend a careful study of the source of graphics.py you can get it from:
http://mcsp.wartburg.edu/zelle/python/graphics.py
Also study the elaborate documentation from:...
Forum: Python 4 Days Ago
Replies: 6
Solved: Temperture
Views: 230
Posted By vegaseat
Python relies on indentations for it's code blocks. Other computer languages use braces, begin, end and so on. So yes, if you want to code in Python, then poorly done indentations can be a real...
Forum: Python 4 Days Ago
Replies: 6
Code Snippet: Plotting with Pylab
Views: 37,943
Posted By vegaseat
after pylab.show() I don't get the >>> in IDLE!
The program stalls on that last pylab.show() statement.

For heaven sake don't run the code from the Python shell!
Run it from the editor!

The...
Forum: Python 4 Days Ago
Replies: 4
Views: 204
Posted By vegaseat
You really don't need a queue, a list will do fine. Here is a more simple version of Gribouillis' code that actually works in Python2 or Python3 ...
# extract tag names in an html code file
#...
Forum: Python 4 Days Ago
Replies: 9
Solved: IDE for PyQt..
Views: 310
Posted By vegaseat
To my knowledge the latest release version of PyQT is 4.6, so I doubt that any IDE will work on code completion for your super advanced version (4.9 ?).
Forum: Python 4 Days Ago
Replies: 4
Views: 169
Posted By vegaseat
Can you tell us in detail what you understand under advanced code completion?

Note (so you don't waste your time): bpython uses Linux's curses and does not work with Windows.
Forum: Python 5 Days Ago
Replies: 10
Views: 283
Posted By vegaseat
According to your code fname is just the filename and b is the full pathname. Still, it will work with os.rename(fname, b).

My question was, what happens if someone enters a directory like this:...
Forum: Python 5 Days Ago
Replies: 9
Solved: IDE for PyQt..
Views: 310
Posted By vegaseat
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 5 Days Ago
Replies: 10
Views: 283
Posted By vegaseat
I modified the program slightly for testing, but this work just fine ...
#!/usr/local/bin/python

import re, os
from os.path import join as pjoin, isdir

while True:
#targetfolder =...
Forum: Python 6 Days Ago
Replies: 11
Views: 360
Posted By vegaseat
@masterofpuppets:

I like the overall tutorial, so simply make your corrections and post it here. Mark it clearly as (first line):
CORRECTED TUTORIAL
I will replace the first version for you....
Forum: Python 6 Days Ago
Replies: 11
Views: 360
Posted By vegaseat
Also note ...
eng2sp = { "one":"uno", "two":"dos", "three":"tres" }

# works in Python2, but not Python3
# Python3 gives error ...
# AttributeError: 'dict' object has no attribute 'has_key'...
Forum: Python 6 Days Ago
Replies: 3
Solved: string.split()
Views: 168
Posted By vegaseat
Good! Just a note, Python3 no longer allows the old style coding!
Forum: Python 6 Days Ago
Replies: 2
Solved: __str__
Views: 151
Posted By vegaseat
__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 6 Days Ago
Replies: 3
Solved: string.split()
Views: 168
Posted By vegaseat
You are using old style Python code! Long ago it used to be like this ...
import string

a = "Why does string.split() not work?"
x = string.split(a)
print("SUCCESS!", x)
... now it's like this...
Forum: Python 6 Days Ago
Replies: 11
Views: 360
Posted By vegaseat
I truly frown on folks using Python Shell code for tutorials, it looks ugly, messy, confusing to beginners, and not Pythonic at all! Python prides itself on readable syntax.

Thanks for the update...
Forum: Python 6 Days Ago
Replies: 10
Views: 327
Posted By vegaseat
You can use function exec() ...
# create variables num1, num2, num3 and num4 and set to 77
for n in range(1, 4):
exec( "%s = %d" % ('num' + str(n), 77) )

print(num1) # 77
print(num3) #...
Forum: Python 6 Days Ago
Replies: 1
Views: 318
Posted By vegaseat
Take a look at the example at:
http://www.daniweb.com/forums/post1056184.html#post1056184
Forum: Python 6 Days Ago
Replies: 127
Views: 46,903
Posted By vegaseat
This simple wxPython slide show uses the wx.PaintDC surface as a canvas that can be cleared between pictures ...
# create a simple image slide show using the
# wx.PaintDC surface as a canvas and
#...
Forum: Python 7 Days Ago
Replies: 78
Views: 14,757
Posted By vegaseat
Tkinter can be used to write programs that use pop-up dialogs for input and output. The nice thing is that the input dialogs can restrict data input to integer, float or string input with options...
Forum: Python 7 Days Ago
Replies: 9
Views: 306
Posted By vegaseat
Will be less complex with a for loop and range(start, end, step) starting at the high value, ending at the low value (exclusive) and stepping -1 ...
n = 3
for x in range(n, 0, -1):
print...
Forum: Python 7 Days Ago
Replies: 10
Views: 445
Posted By vegaseat
I assume the question is:
Who is foolish enough to do my homework for me?
Forum: Python 7 Days Ago
Replies: 3
Views: 173
Posted By vegaseat
Also take a look at:
http://www.daniweb.com/forums/post1055261.html#post1055261
for a mildly more general version.
Forum: Python 7 Days Ago
Replies: 78
Views: 14,757
Posted By vegaseat
A simple way to add color highlighted text to the Tkinter Text() widget ...
# multiple color text with Tkinter using widget Text() and tags
# vegaseat

try:
# Python2
import Tkinter as...
Forum: Python 7 Days Ago
Replies: 10
Views: 339
Posted By vegaseat
You have to put your increase calculation in the loop.
Forum: Python 8 Days Ago
Replies: 2
Views: 167
Posted By vegaseat
What does the trace-back look like?
Showing results 1 to 40 of 1000

 


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

©2003 - 2009 DaniWeb® LLC