Search Results

Showing results 1 to 40 of 1000
Search took 0.08 seconds.
Search: Posts Made By: Ene Uran
Forum: Geeks' Lounge Oct 3rd, 2009
Replies: 1,376
Views: 146,720
Posted By Ene Uran
Chicken nuggets with beer.
Forum: Python Sep 29th, 2009
Replies: 22
Views: 927
Posted By Ene Uran
Something only Microsoft could dream up. I understand that in the European version of Windows the space is avoided. The kludge itself is from a programmer within Microsoft.
Forum: Python Sep 29th, 2009
Replies: 6
Views: 546
Posted By Ene Uran
A very simple way:
# create a string where the index gives the grade
grade_str = 'F'*60 + 'D'*10 + 'C'*10 + 'B'*10 + 'A'*11
# ask for grade number input
grade = int(raw_input("Enter the student's...
Forum: Python Sep 29th, 2009
Replies: 22
Views: 927
Posted By Ene Uran
This is often referred to as the little-known "Microsoft kludge"
Forum: Python Sep 29th, 2009
Replies: 9
Views: 410
Posted By Ene Uran
You can concatenate tuples, the trick is to wrote the one element tuple correctly:
users = ('user1','user2','user3')

# from input ...
new_user = 'user4'

# concatenate tuples, notice the way...
Forum: Python Sep 29th, 2009
Replies: 22
Views: 927
Posted By Ene Uran
This problem has been around for a long time and not just with Python:
# the "Microsoft kludge", quoting a string within a string fixes the
# space-in-folder-name problem, tells the OS to use the...
Forum: Python Sep 28th, 2009
Replies: 20
Solved: Text Files
Views: 557
Posted By Ene Uran
That is because I made a test file from your posting and put it into the working directory, the same directory the code file is in.

Since you have the real thing you can replace
fname =...
Forum: Python Sep 28th, 2009
Replies: 5
Views: 287
Posted By Ene Uran
Those modules are often written by instructors in colleges to keep their students from simply copying existing code, spreading confusion for the rest of us! There is a similar module out called...
Forum: Geeks' Lounge Sep 27th, 2009
Replies: 143
Views: 8,842
Posted By Ene Uran
It easier to make fun of something you don't understand, than trying to understand it.

For instance a frequent phrase used by US politicians:
"The Canadian and British Health Care System is a...
Forum: Geeks' Lounge Sep 27th, 2009
Replies: 411
Views: 43,341
Posted By Ene Uran
"Dutch treat" in Holland is
"op zijn Amerikaans"
("in an American way")
Forum: Geeks' Lounge Sep 27th, 2009
Replies: 1,548
Views: 199,960
Posted By Ene Uran
Don't get even!
Get odd!
Forum: Python Sep 27th, 2009
Replies: 6
Views: 220
Posted By Ene Uran
Try
ascii += cs_string
Forum: Python Sep 27th, 2009
Replies: 6
Views: 227
Posted By Ene Uran
Did you use the .msi binary installer to install Python?

How are you trying to open python.exe?

Normally you find the IDE called Idle.pyw somewhere in the Python folders (like...
Forum: Python Sep 27th, 2009
Replies: 5
Views: 287
Posted By Ene Uran
cTurtle.py has nothing to do with C. It is simply someones hack of the turtle.py with a few extra methods added. See the beginning of file cTurtle.py for details. You can also run it, as it has a...
Forum: Python Sep 27th, 2009
Replies: 10
Views: 499
Posted By Ene Uran
Try something like this:
label = list(range(len(files)))
for k, fname in enumerate(files):
image = Image.open(filedir+"/"+fname)
##((width, height))
...
Forum: Python Sep 27th, 2009
Replies: 10
Views: 499
Posted By Ene Uran
You could take each labelobject an append it to a list.
Forum: Python Sep 27th, 2009
Replies: 7
Views: 747
Posted By Ene Uran
Try something like:
lineA = fin.readline()[lpa].strip()
Forum: Python Sep 27th, 2009
Replies: 20
Solved: Text Files
Views: 557
Posted By Ene Uran
See if something like this will do, but be careful that all the slicing doesn't steal some data:
def extract_number(data_str):
"""
extract the numeric value from a string
(the string...
Forum: Python Sep 27th, 2009
Replies: 3
Views: 221
Posted By Ene Uran
Also in Python3 'pg_r' would be a byte string and module re will complain without converting 'pg_r' to a string first.
Forum: Python Sep 27th, 2009
Replies: 45
Views: 2,515
Posted By Ene Uran
self.panel everywhere except the most important line 12

panel=wx.Panel(self,-1)
needs to be
self.panel=wx.Panel(self,-1)
Forum: Python Sep 27th, 2009
Replies: 3
Views: 410
Posted By Ene Uran
Are you sure you posted in the right place? This is not the Mindreader Forum!
Forum: Python Sep 27th, 2009
Replies: 10
Views: 499
Posted By Ene Uran
Hint:
Looks to me like you are creating the same label over and over again.
Forum: Python Sep 27th, 2009
Replies: 45
Views: 2,515
Posted By Ene Uran
You don't need the id as a method parameter, but at least try to match the id in the lines above, 202 is not the same as 302.

self.panel will work if you use it throughout the class! Search for...
Forum: Python Sep 27th, 2009
Replies: 6
Views: 227
Posted By Ene Uran
Pythons normally don't come with a handle, this must be a new breed.
Forum: Python Sep 26th, 2009
Replies: 4
Views: 261
Posted By Ene Uran
In this case you have to set a flag like this:
import sys

# there is a commandline
if len(sys.argv) > 1:
mylist = []
# sys.argv[0] is the program filename, slice it off
flag =...
Forum: Python Sep 26th, 2009
Replies: 4
Views: 261
Posted By Ene Uran
Give this a try:
import sys

# there is a commandline
if len(sys.argv) > 1:
mylist = []
# sys.argv[0] is the program filename, slice it off
for element in sys.argv[1:]:
...
Forum: Python Sep 26th, 2009
Replies: 75
Views: 13,615
Posted By Ene Uran
There is another Python version called IronPython that uses Python syntax. It runs independent from the normal CPython version and allows access to the large GUI libraries of .NET and Mono. Here is...
Forum: Python Sep 26th, 2009
Replies: 7
Views: 333
Posted By Ene Uran
You can trap error details this way:
import datetime as dt

def ObtainDate():
isValid=False
while not isValid:
userIn = raw_input("Type Date dd/mm/yy: ")
try: #...
Forum: Python Sep 26th, 2009
Replies: 3
Views: 258
Posted By Ene Uran
You can also check into the use of the PyQT GUI toolkit. It is available free and even works with Python 3.1. There is an example here that should work with your application:...
Forum: Python Sep 8th, 2009
Replies: 4
Views: 257
Posted By Ene Uran
I don't think it's possible because py2exe does not include any source, only the byte code compiled files in case you go for the zip file option.
Forum: Python Sep 7th, 2009
Replies: 2
Views: 433
Posted By Ene Uran
It's not quite as simple!

However you use Portable Python. It installs a portable version of Python right on an inexpensive USB flash drive (plan on 150MB for each version). You can use the flash...
Forum: Python Sep 7th, 2009
Replies: 18
Views: 1,161
Posted By Ene Uran
FYI,
upper = list(string.ascii_uppercase)
Forum: Python Sep 7th, 2009
Replies: 4
Views: 272
Posted By Ene Uran
Give us your code and we will help you understand.
For instance:
def myloop():
for x in range(5):
y = 2*x
return y

# this will give 8, since the last x in the loop was 4...
Forum: Python Sep 7th, 2009
Replies: 18
Views: 1,161
Posted By Ene Uran
Take a looky here:
import string

print(string.digits)
print(string.ascii_lowercase)
print(string.ascii_uppercase)

# optional ...
#help(string)
Forum: Python Sep 7th, 2009
Replies: 75
Views: 13,615
Posted By Ene Uran
A similar table, this time we use PyQT's QTableView and QAbstractTableModel which allows the items in the table to be sorted by simply clicking on the header titles:
# use PyQT's QTableView and...
Forum: Python Sep 7th, 2009
Replies: 75
Views: 13,615
Posted By Ene Uran
Thanks vegaseat for the newer PyQT style info. Here is a relatively simple way to display tabular data using a function to create an html coded table:
# PyQT's QLabel widget can display html...
Forum: Python Sep 5th, 2009
Replies: 194
Read Me: Starting Python
Views: 85,307
Posted By Ene Uran
Sometimes it's nice to have static variable in a function. A static variable remembers its last value. Here is one way to do it with Python:
# a class can give all global variables a save...
Forum: Python Sep 5th, 2009
Replies: 194
Read Me: Starting Python
Views: 85,307
Posted By Ene Uran
Have you ever wondered what 'self' is doing when you use Python classes? Here is the short and sweet of it:
# role of self in Python classes
# self can be named different, but 'self' is convention...
Forum: Python Sep 5th, 2009
Replies: 2
Views: 313
Posted By Ene Uran
Look over this code sample, it should be very explanatory:
# role of self in Python classes
# self can be named different, but 'self' is convention

class Snake:
def __init__(self, name):
...
Forum: Python Sep 4th, 2009
Replies: 11
Views: 579
Posted By Ene Uran
Ouch! Thanks Lingson, I overlooked that range() does not return a list in Python3. So I give you the correct version here:
# exploring multiple Tkinter check buttons
# check buttons allow more...
Showing results 1 to 40 of 1000

 


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

©2003 - 2009 DaniWeb® LLC