a1eio 16 Junior Poster

hi,

The following code is the find function part of your code but with part of the solution
it now prints the index (location) of the begining of a string or letter but i havn't a clue how to highlight text.

def find():
    findStr = tkSimpleDialog.askstring("Find", "Find:") # Prompts user to enter a string, if nothing is entered, function returns None
    if findStr: # Test to see if the function returned a string or None
        print findStr
        start = 1.0
        while 1:
            position = text.search(findStr, start, stopindex=END)
            if not position:
                break
            print "string was found at ", position
            start = position + "+1c"
    else:
        print 'nothing was entered'

the text widget uses index's, 1.0 would mean the first row (1) and the first column (0)
just picture the text widget as a grid, with one character in each square

so when you enter a string to search, it returns either nothing (if nothing was found) or the index for the first character in the string.

at the end of the while loop, the "+1c" means +1 column.

www.pythonware.com has documentation for all of Tkinter

a1eio 16 Junior Poster

not too sure what you meant mate but www.pythonware.com has a great documentation for Tkinter, here's a link to a page on the site that may or may not help you:
http://www.pythonware.com/library/tkinter/introduction/x953-menus.htm

a1eio 16 Junior Poster

hmm well i've little experience with pygame myself but are you sure your not missing something in your code?
i think you need to type stuff like pygame.init() and you have to flip the display stuff like that, like i said i'm not too sure but if you go on the pygame website http://www.pygame.org they might have something in the documentaion or go on their irc channel
a snippet of your code might be good?
then someone can look at it and see whats wrong

a1eio 16 Junior Poster

Wehey very nice thats solved my issue

a1eio 16 Junior Poster

Thats a very good point, i never looked at it that way, and i bet that if you use the py2exe to make a 'portable' program because it ships with the python24dll thingy then maybe thats actually a little more multi-system than a bog standard compiled exe. (then again maybe not hehe all speculation)

a1eio 16 Junior Poster

Yea but Micko has a point. it does suck when you want to take a simple short and sweet program you made with python to school or an internet cafe or any other place where you are not allowed to install stuff, i mean py2exe is good but whenever i use it i get a whole load of crap thrown in with the exe and a folder that has 5 or 6 .py files (i know they are needed but it's still anoying), ok it's good if you know where you are going but for quick and easy compilation and running python does lack...a lot

a1eio 16 Junior Poster

I'm not very certain on classes and stuff like that myself but i'm guessing and from what i've read i think if you do

class namehere(calender_name):
    stuff here

can't guarantee it will work (not on my computer so i can't get at python to try it)
but it's just an idea

a1eio 16 Junior Poster

no probs, glad i could help :)

*edit: that smiley looks evil

a1eio 16 Junior Poster

havn't got an example, but my very rough guess is maybe you could do something along the lines of;

wrap a function around the time.sleep() function that when called it starts the sleep in another thread so that the program will only continue untill;
sleep ends,
thread gets killed (stoppped)
so the way to interrupt could be to manually shut down the thread which in turn would shut down the sleep

OR

you could make your own sleep class that allows you to kill it?

something along those lines anyway
not too experienced on threading or using classes

a1eio 16 Junior Poster

just use clean python:

>>> a = 5
>>> b = 4
>>> a, b = b, a
>>> a
4
>>> b
5
>>> a = 'text1'
>>> b = 'text2'
>>> a, b = b, a
>>> a
'text2'
>>> b
'text1'
>>>