Search Results

Showing results 1 to 40 of 248
Search took 0.02 seconds.
Search: Posts Made By: Ene Uran
Forum: Python 1 Day Ago
Replies: 2
Views: 101
Posted By Ene Uran
Thanks for letting us know. I would have done it the same way too, since Frame has the convenient borderwidth arg.
Forum: Python 6 Days Ago
Replies: 3
Views: 227
Posted By Ene Uran
Maybe you should give your thread a more meaningful title.
Forum: Python 6 Days Ago
Replies: 7
Solved: temperature?
Views: 326
Posted By Ene Uran
This will give your program a certain eloquence:
# convert temperatures using Python2 or Python3

def f2c( fahrenheit ):
"""convert Fahrenheit to Celsius"""
return ( fahrenheit - 32 ) *...
Forum: Python 6 Days Ago
Replies: 5
Views: 235
Posted By Ene Uran
Good show! So the question is, can you use your program to compute all the trig functions you wanted (sin, cos, tan, arcsin, etc.).
Forum: Python 6 Days Ago
Replies: 9
Solved: variables
Views: 304
Posted By Ene Uran
Just a general example of functions and their parameters/arguments:
# example of passing parameters/arguments to and from functions

def get_data():
"""get the data from the user, from a...
Forum: Python 10 Days Ago
Replies: 10
Views: 493
Posted By Ene Uran
The first problem could be kind of easy:
n = 11
for odd_number in range(1, n+1, 2):
print( odd_number )

"""
1
3
5
7
Forum: Python Sep 29th, 2009
Replies: 22
Views: 963
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: 618
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: 963
Posted By Ene Uran
This is often referred to as the little-known "Microsoft kludge"
Forum: Python Sep 29th, 2009
Replies: 9
Views: 424
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: 963
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: 586
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 27th, 2009
Replies: 6
Views: 227
Posted By Ene Uran
Try
ascii += cs_string
Forum: Python Sep 27th, 2009
Replies: 10
Views: 515
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: 515
Posted By Ene Uran
You could take each labelobject an append it to a list.
Forum: Python Sep 27th, 2009
Replies: 7
Views: 807
Posted By Ene Uran
Try something like:
lineA = fin.readline()[lpa].strip()
Forum: Python Sep 27th, 2009
Replies: 20
Solved: Text Files
Views: 586
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: 227
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,787
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: 10
Views: 515
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,787
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 26th, 2009
Replies: 4
Views: 278
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: 278
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: 7
Views: 339
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 4th, 2009
Replies: 11
Views: 634
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...
Forum: Python Sep 3rd, 2009
Replies: 6
Solved: Beginners help!
Views: 438
Posted By Ene Uran
A nice brain teaser to get to know Python, here are some hints:
"""wants dictionary object -->
{'toy301': ('Flying Kite', [('AB339',2),('DC302',2),('FR377',2),...
Forum: Python Sep 3rd, 2009
Replies: 11
Views: 634
Posted By Ene Uran
There is a working example of Tkinter's radio buttons and also a comparative look at check buttons at:
http://www.daniweb.com/forums/showpost.php?p=966368&postcount=58
Forum: Python Jul 13th, 2009
Replies: 5
Views: 683
Posted By Ene Uran
If you are specifically looking for the text line:
'you love me'
then sravan953 code works best.

leegeorg07 code using 'in' would also give you a positive with a line like:
'you love me not'...
Forum: Python Jul 8th, 2009
Replies: 4
Views: 287
Posted By Ene Uran
Simply use list():
list1 = ['a', 'b', 'c', 'd']
# this will create a new list with a different mem ref
temp_list1 = list(list1)
for i in range(len(list1)):
temp_list1[i] = "1"
print list1; ...
Forum: Python Jul 7th, 2009
Replies: 7
Views: 476
Posted By Ene Uran
Might as well go with:

...
background = "C:\\python26\\stuff\\bg.jpg"
background_surface = pygame.image.load(background)
...
Since that kind of directory name is meant for Windows only.
Forum: Python Jul 7th, 2009
Replies: 5
Views: 371
Posted By Ene Uran
Where are your FileIn and FileOut strings?
Forum: Python Jul 7th, 2009
Replies: 6
Views: 376
Posted By Ene Uran
You mean something like this:
# data string read from a file
data = """\
gnl|dbSNP|rs13484118 gi|62750812|ref|NC_005111.2|NC_005111 95 20 1 0 68 87 31017559 31017578 4.4 32.3
gnl|dbSNP|rs13484118...
Forum: Python Jul 6th, 2009
Replies: 2
Views: 469
Posted By Ene Uran
One way to do this is to pad each word with spaces at the end to make the words equal in length (max length + 2):
s = """\
dasj dhsahdwe dhasdhajks ewqhehwq dsajkdhas
edward das dsaw das daswf...
Forum: Python Jul 6th, 2009
Replies: 3
Views: 430
Posted By Ene Uran
What do you expect to happen with your test code?
If you test the module properly, it will work:
# create two separate windows with a button on it
# notice that the close button will close both...
Forum: Python Jul 6th, 2009
Replies: 3
Views: 430
Posted By Ene Uran
Take the spaces out of "[code = python]"
Forum: Python Jul 5th, 2009
Replies: 4
Views: 364
Posted By Ene Uran
@sravan953
also remember that in Python2 ' /' is an integer division by default.
For instance 12/15 gives you a zero. This has changed in Python3.
Forum: Python Jun 23rd, 2009
Replies: 6
Views: 335
Posted By Ene Uran
Your problem is too simple to bother with regex:
mylist = ['adam', 'bill', 'jon/juan']

newlist = [item.replace('/', '') for item in mylist]

print(mylist) # ['adam', 'bill', 'jon/juan']...
Forum: Python Jun 23rd, 2009
Replies: 5
Solved: Python 3.0
Views: 369
Posted By Ene Uran
I you are on Windows and have several versions of Python installed, you can write a little batch file to make sure the IDLE of the correct version is runnig:
REM a batch file to force IDLE to use...
Forum: Python Jun 23rd, 2009
Replies: 6
Views: 350
Posted By Ene Uran
Maybe something like this:
import random

low = 1
high = 9

mylist = [(random.randint(low, high), ) for k in range(10)]

print(mylist)
Forum: Python Jun 13th, 2009
Replies: 7
Views: 306
Posted By Ene Uran
Here is an example:
http://www.daniweb.com/forums/showpost.php?p=890166&postcount=111
Showing results 1 to 40 of 248

 


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

©2003 - 2009 DaniWeb® LLC