JoshuaBurleson 23 Posting Whiz

Do you have a link to the CDN for jquery? What does your console output say?

JoshuaBurleson 23 Posting Whiz

Okay, I haven't been on in a while, let me tell you why no one has replied, you haven't showed ANY effort. Let me see the code you have so far and I'll tell you what you're doing wrong and give you suggestions. This is a simple solution, and you would get the answer in 2 seconds by looking at your text book or anyother reference and apply some logic.

JoshuaBurleson 23 Posting Whiz

I want to know if it's high school or college, I really hope high school.

JoshuaBurleson 23 Posting Whiz

Tisk tisk, sounds like some points off for attempted academic dishonesty to me...

JoshuaBurleson 23 Posting Whiz

Oh, please tell me someone finally got caught doing that by their teacher. Also think about range, it should take you about 45 seconds to do this program if you just take a moment to think about it.

JoshuaBurleson 23 Posting Whiz

fyi, there is no elseif in python...

JoshuaBurleson 23 Posting Whiz

I don't know about anyone else, but I'm getting a little tired of the "I goggled for this" lie http://tinyurl.com/3ldotwl Perhaps we should boycott the too obvious fibs and point them out as above.

Edit: But then I guess that's the same thing, as that's doing the search effort which provides the lazy with the code from the search. Back to pointing out the "we only help those who show effort" links. They are http://www.daniweb.com/software-development/computer-science/threads/573
http://www.daniweb.com/software-development/computer-science/threads/573/3625#post3625
http://www.daniweb.com/software-development/cpp/threads/78223

I'm sorry, I'm not really contributing to the discussion as I'm completely sick of this matter altogether but I just have to say wooeee, I loved that I haven't laughed that hard in a while.

JoshuaBurleson 23 Posting Whiz

The way I'm interpreting it is like:

that='''450 42.5 16625.0
460 42.0 16820.0
470 41.5 17005.0
480 41.0 17180.0
490 40.5 17345.0
500 40.0 17500.0'''

this=that.split('\n')
price=None
for info in this:
    data=info.split()
    if price==None:
        price=data[1]
    elif data[1]<price:
        for info in data:
            print('XXXX is %s'%info)
        break

output:

>>> 
XXXX is 460
XXXX is 42.0
XXXX is 16820.0
>>>

but your saying the price starts to drop and I don't know if the second one is the price or the first or the third... you didn't give us enough info to go on...

JoshuaBurleson 23 Posting Whiz

issues:

-input is a BIF

-fix your indentation

-think about it; how would you use the functions on anything? That should help you use them in the main() function

-I'm sure there are more but I don't feel like analyzing this whole thing with the indentation all messed up, it's a pain to read.

JoshuaBurleson 23 Posting Whiz

I like dictionaries, I made a function see if you can tell what it does from this:

>>> grade_buk=[('tom',4),('ben',5),('tom',8),('ben',12)]
>>> grades=average(grade_buk)

>>> for key in grades:
	print(key.title()+':',grades[key])

	
Ben: 8.5
Tom: 6.0
JoshuaBurleson 23 Posting Whiz

It's giving me an empty list....

That's probably because, as I said, you need to reformat it to work for your file. I'll attach my file and show you the output:

output:

[[56.71739, 56.65762, 56.61648, 56.63215, 56.98378, 57.78903, 58.81514, 59.98271, -1.0, 56.05496, 56.00158, 55.9683, 56.70977, 57.64234, 58.75118, 59.94779, 55.47366, 55.39739, 55.3502, 55.36098, 55.7111, 56.51588, 57.5418, 58.70937], [56.6795, 56.60323, 57.34681, 59.38853, 56.09566, 55.98341, 56.07384]]
JoshuaBurleson 23 Posting Whiz

or you could make an array of arrays "if it could suit your needs" with something like:

with open('help.txt') as f:
    linez=f.readlines()

aRray=[]
def make_list(lines,array):
    to_append=[]
    for line in lines:
        if ' ' in line:#I used this because of how the file is formatted for me, it this doesn't work for you maybe '\t' will, Idk
            lines.remove(line)
            array.append(to_append)
            make_list(lines,array)
        else:
            num=(line.strip('\n'))
            try:
                to_append.append(float(num))
            except ValueError:
                pass
            lines.remove(line)
make_list(linez,aRray)

print(aRray)

then the arrays in that large array could be accessed just as any other iterable: or you could make a dictionary of it with a similar process if you wished. And this function could easily be manipulated, I just didn't care what happened to linez after it was iterated through, maybe you do, idk.

JoshuaBurleson 23 Posting Whiz

when you get a whitespace stop, build the array with those lines and go ahead to build the next array with the next 24 lines.

so you want separate arrays instead of one large one?

JoshuaBurleson 23 Posting Whiz
JoshuaBurleson 23 Posting Whiz

well I don't see a space or tab in any of the other kind. so what if we checked the contents of each line and checked for spaces or tabs?

JoshuaBurleson 23 Posting Whiz

Because the Label widget does not provide features which I need (although Text also disables some of them with "disabled", which is the issue here).

User will interact with program by selecting a line or a portion of the text. I think Label does not allow user to select and see, nor the program to see what user selects.

And later I'll need to format the text, columns, font, color. Need a scrollbar with functional page up/down keys, etc...

What exactly do you mean select and see, how is the user selecting? I need more context.

JoshuaBurleson 23 Posting Whiz

well think about how you would skip them...what is the easiest way to distinguish that particular piece of data from the others? To me it looks like maybe it's the fact that

data[0] is in

"not sure which it is" where data is the line

JoshuaBurleson 23 Posting Whiz

have you tried a lambda? like:

>>> lis
[(1, 'A'), (3, 'D'), (1, 'Z'), (3, 'F')]
>>> 
>>> fixed=sorted(sorted(lis,key=lambda s: s[1]),key=lambda i: i[0],reverse=True)
>>> 
>>> fixed
[(3, 'D'), (3, 'F'), (1, 'A'), (1, 'Z')]
>>>
JoshuaBurleson 23 Posting Whiz

Why don't you just use a label widget?

JoshuaBurleson 23 Posting Whiz

found the solution. On Windows vista in the command prompt enter:

C:/Python32/Scripts cxfreeze --base-name=Win32GUI theapplication.py

where theapplication.py is the name of your file

JoshuaBurleson 23 Posting Whiz

is there a way to make cx_freeze utilize the no console property of .pyw files?

JoshuaBurleson 23 Posting Whiz

I'm trying to use cx_Freeze and everything everything seems like it should work fine, however I'm getting an import error for import tkinter

Traceback
#...
from tkinter import __fix
#...
import_tkinter
ImportError: DLL load failed: The specified module could not be found.

This only happens when I take the the contents "all of it" out of the C:/Python32/Scripts/distany directory, inside there it works fine. any insight?

EDIT: it appears this issue is resolved, however is there a way to make the program easier to access for the user when I make a zip of it and its dependencies, since there are so many?

JoshuaBurleson 23 Posting Whiz

Looks interesting and fun. Thanks for the introduction vegaseat. If i may ask, what good books would you recommend for starters?

How to think like a computer scientist is great for beginners as is Python programming for the absolute beginner. If you already have experience with a programming language head first python and dive into python 3 are also very good.

JoshuaBurleson 23 Posting Whiz

When I open python I am unable write my code in it. This just started to happen no idea what is happening? Its unclickable inside but I can click the bar on top. Anybody know?

What do you mean? Like you're unable to edit a program you've made, or IDLE isn't working??? You don't really get locked out of Python..

JoshuaBurleson 23 Posting Whiz

maybe I'm misunderstanding, but wouldn't something simple like

def make_norm_lis(entry):
	lis=[]
	for letter in entry:
		if letter.isalpha():
			lis.append(letter)
		else:
			lis.append(' ')
	lis=''.join(lis)
	lis=lis.split()
	return lis

work?

>>> st='!@#this@#$is//sparta'
>>> print(make_norm_lis(st))
['this', 'is', 'sparta']
>>> 
>>> work='i.going.to.work'
>>> 
>>> print(make_norm_lis(work))
['i', 'going', 'to', 'work']
JoshuaBurleson 23 Posting Whiz

well think about what you would need to do; you'd need to either have a list of the images or be in a specified directory to browse through the images in that; some useful tools might be:

tkFileDialog, askopenfilename

PIL,Image, ImageTk (ImageTk.PhotoImage)

os

JoshuaBurleson 23 Posting Whiz

Don't bump old threads...start a new thread with your problem.

JoshuaBurleson 23 Posting Whiz

There's a sticky on beginner project ideas at the beginning of the forum. Check 'em out. Also there are a couple more advanced projects here.

JoshuaBurleson 23 Posting Whiz

well easy enough; I'd say lists are easier; breaking it down I would do something like "not really showing you too much new here, just showing how what I showed you before but with lists":

def make_dic(file):
    with open(file,'r') as f:
        file=f.readlines()
    dic={}
    for line in file:
        line=line.split(' ')
        clean_lis=[]
        for num in line:
            if num!='':
                clean_lis.append(num)
        dic[int(clean_lis[0])]=[clean_lis[1]+' ',float(clean_lis[2].strip('\n'))]
    return dic

def lup_bal(lis,up):
    cur=lis[-1]
    update=float(cur)+float(up)
    lis.pop()
    new=[account for account in lis]
    new.append(update)
    lis.pop()
    return new

Note that in the following I used what you posted and added one to the original file called 192, that way you could see the change, so really only pay attention to 192's change.

>>> bank=make_dic('help.txt')
>>> 
>>> 
>>> bank
{192: ['094-11-2328 ', 3322.25], 115: ['139-28-4313 ', 1056.3], 143: ['595-74-5767 ', 4289.07], 155: ['972-87-1379 ', 3300.26], 135: ['706-02-6945 ', -99.06]}
>>> 
>>> with open('help3.txt') as f:
	for line in f:
		line=line.split()
		key=int(line[0])
		value=float(line[1])
		if key in bank.keys():
			bank[key]=lup_bal(bank[key],value)

			
>>> bank
{192: ['094-11-2328 ', 2491.41], 115: ['139-28-4313 ', 1056.3], 143: ['595-74-5767 ', 4289.07], 155: ['972-87-1379 ', 3300.26], 135: ['706-02-6945 ', -99.06]}

This isn't the best or easiest way to do it, but I believe it gets the idea across.

[B]help.txt[/B]
115     139-28-4313     1056.30
135     706-02-6945      -99.06
143   595-74-5767     4289.07
155     972-87-1379     3300.26
192   094-11-2328     3322.25
[B]help3.txt[/B]
380     2932.48
192     -830.84
379     2338.82
249     3444.99
466      -88.33
JoshuaBurleson 23 Posting Whiz

Here's the words from "Python Programming: An Introduction to Computer Science"

Ch 6, programming exercise 13:

13. Write and test a function to meet this specification:

toNumbers(strList) strList is a list of strings, each of which represents a number. Modifies each entry in the list by converting it to a number.

right, you are modifying each item in the list into a number instead of a string, and returning a list of numbers INSTEAD of a list of strings.