Search Results

Showing results 1 to 40 of 1000
Search took 0.08 seconds.
Search: Posts Made By: vegaseat ; Forum: Python and child forums
Forum: Python 3 Days Ago
Replies: 3
Views: 136
Posted By vegaseat
Our fellow Pythonian nezachem is correct.

You could also have used the usual
if __name__ == '__main__':
to test your module code ...
#!/usr/bin/python
# ChildScript.py

import tkSimpleDialog...
Forum: Python 3 Days Ago
Replies: 8
Solved: urgent help!!!
Views: 241
Posted By vegaseat
Hint, another approach would be to use the function split() ...
text1 = "80,45,34"
if "," in text1:
# split at comma
mylist1 = text1.split(",")
print( mylist1 ) # ['80', '45', '34']...
Forum: Python 3 Days Ago
Replies: 7
Views: 211
Posted By vegaseat
In code line
if stemming_word[-1] == leaf_words:
you are trying to compare a character with a tuple.

# this will form a tuple
leaf_words = "s","es","ed","er","ly","ing"

print( leaf_words ) ...
Forum: Python 5 Days Ago
Replies: 14
Views: 427
Posted By vegaseat
Again, when you install Python on a Windows computer, Tkinter and Tk that install with it rely on the Windows GUI and not Xlib.
Forum: Python 5 Days Ago
Replies: 2
Views: 125
Posted By vegaseat
str(i).split() will give you a list and you cannot use strip("'") on a list object. If your list contains strings, pick one item and then strip it.
Forum: Python 6 Days Ago
Replies: 2
Views: 237
Posted By vegaseat
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: Python 10 Days Ago
Replies: 3
Solved: Flip
Views: 190
Posted By vegaseat
Take a look at this recent thread:
http://www.daniweb.com/forums/thread241860.html
were we discussed functions and parameter passing.
Forum: Python 10 Days Ago
Replies: 14
Views: 427
Posted By vegaseat
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 10 Days Ago
Replies: 14
Views: 427
Posted By vegaseat
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 11 Days Ago
Replies: 9
Solved: variables
Views: 395
Posted By vegaseat
You pass variables as need as function arguments and/or returns.
Forum: Python 12 Days Ago
Replies: 3
Views: 323
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 12 Days Ago
Replies: 9
Solved: variables
Views: 395
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 12 Days Ago
Replies: 7
Solved: temperature?
Views: 383
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 13 Days Ago
Replies: 5
Views: 266
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 14 Days Ago
Replies: 5
Views: 240
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 14 Days Ago
Replies: 15
Solved: Scorecard
Views: 479
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 15 Days Ago
Replies: 7
Solved: Temperture
Views: 334
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 15 Days Ago
Replies: 9
Solved: IDE for PyQt..
Views: 450
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 16 Days Ago
Replies: 10
Views: 358
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 16 Days Ago
Replies: 9
Solved: IDE for PyQt..
Views: 450
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 16 Days Ago
Replies: 10
Views: 358
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 17 Days Ago
Replies: 2
Solved: __str__
Views: 218
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 17 Days Ago
Replies: 3
Solved: string.split()
Views: 263
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 17 Days Ago
Replies: 10
Views: 391
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 17 Days Ago
Replies: 1
Views: 413
Posted By vegaseat
Take a look at the example at:
http://www.daniweb.com/forums/post1056184.html#post1056184
Forum: Python 18 Days Ago
Replies: 9
Views: 380
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 18 Days Ago
Replies: 10
Views: 526
Posted By vegaseat
I assume the question is:
Who is foolish enough to do my homework for me?
Forum: Python 18 Days Ago
Replies: 3
Views: 239
Posted By vegaseat
Also take a look at:
http://www.daniweb.com/forums/post1055261.html#post1055261
for a mildly more general version.
Forum: Python 18 Days Ago
Replies: 10
Views: 385
Posted By vegaseat
You have to put your increase calculation in the loop.
Forum: Python 19 Days Ago
Replies: 6
Views: 308
Posted By vegaseat
No need to be sorry, that kind of thing happens easily on any forum.
Forum: Python 19 Days Ago
Replies: 6
Views: 308
Posted By vegaseat
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: Python 21 Days Ago
Replies: 3
Views: 284
Posted By vegaseat
If you make the regular polygon a square with side length = 1.0, you should get an area of 1.0. A simple test to see if the area formula is correct.
Forum: Python 21 Days Ago
Replies: 4
Views: 253
Posted By vegaseat
You can play with this ...
# test Python command line arguments

import sys

if (len(sys.argv) >= 2):
# skip sys.argv[0]
commandline_args = sys.argv[1:]
print( commandline_args )
Forum: Python 21 Days Ago
Replies: 3
Views: 536
Posted By vegaseat
If you have a dictionary in your program and want to save and later reload it as a dictionary object, you have to use module pickle. Here is an example ...
# use module pickle to save/dump and load...
Forum: Python 22 Days Ago
Replies: 5
Views: 291
Posted By vegaseat
A dictionary will serve you better ...
# create a large number of spheres referencing them
# with a (x, y):sphere_object dictionary pair

import visual as vs

spheres = {}
for x in range (0,...
Forum: Python 23 Days Ago
Replies: 8
Views: 348
Posted By vegaseat
I assume your error is here ...
def print_list(names):
print 'Here are the names in the original order:'
for names in name_list: # <--------
print names
names.sort()
...
Forum: Python 23 Days Ago
Replies: 9
Views: 318
Posted By vegaseat
Python3 will tolerate adding (object) to your class for a while at least.
After that just write a little Python utility that removes it.
Forum: Python 23 Days Ago
Replies: 4
Views: 240
Posted By vegaseat
Here is the story:

In Python2 Tkinter is a Python module file named Tkinter.py a wrapper for the TCL code Tkinter is written in.

With the advent of Python3 Tkinter became a more modern package...
Forum: Python 23 Days Ago
Replies: 6
Solved: While loop
Views: 321
Posted By vegaseat
If you want to start with the population after 1/2 year, then every year you have to change your code to this (Python2 or Python3) ...
def populationGrowth():
x = int(input("What is the current...
Forum: Python 23 Days Ago
Replies: 5
Views: 274
Posted By vegaseat
In this case you have to create a new parent frame (size it for the image) for wx.StaticBitmap(frame, wx.ID_ANY, image)

Would be nice if I could test it out, but I simply don't have all the...
Showing results 1 to 40 of 1000

 


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

©2003 - 2009 DaniWeb® LLC