woooee 814 Nearly a Posting Maven

You will have to identify the global variables, bet et al. Otherwise, you will be using a second block of memory that is also named bet but local to the function.

if bet  == "quit":
                break
            elif float(bet) <= 0 or float(bet) > x:
                print "Invalid bet."
            else:
                print x, "is a valid amount to bet"
                ##    This would also work
                bet_loop=1
                break

This works much better as a class.

class Betting:
    def __init__(self):
       self.bank = 500.00
       self.bet = 0.00
   
    # defines the betting process within the program
    def bet1(self):
        #set bet loop
        bet_loop=0
        #loop the bet process until the bet is valid
        while bet_loop == 0:
            #tell how much money you have        
            print "You have", self.bank, "dollars in the bank, how much do you bet?"
            #input b            
            self.bet = raw_input("Wager?") 
            #test to make sure that b and x stayed (i did this because it won't work.)            
            print "self.bet in class =", self.bet
            print "self.bank in class=", self.bank
            #checks to see if your bet is valid   
            if self.bet  == "quit":
                break
            elif float(self.bet) <= 0 or float(self.bet) > self.bank:
                print "Invalid bet."
            else:
                print self.bet, "is a valid amount to bet"
                print "if you win you will have %7.2f dollars" % (float(self.bet) +self.bank)
##                bet_loop=1     ## another option
                break 

##=====================================================================
if __name__ == "__main__":
   ## create an instance of the class
   BB=Betting()     ## or instantiate the class (an awful word)
                    ## when you destroy the class do you outstantiate?
   BB.bet1()     ## run this function in the class
   #another …
woooee 814 Nearly a Posting Maven

Add a print statement at the beginning of who wins to see if you actually enter it or not. If the value of turnTuple is not found, nothing will happen. And this definitely should be a class IMHO. It's time to learn classes. It will make coding a lot easier.

def whoWins(): 
     ##--------- added  -----------------------------------------
     print "executing whoWins", turnTuple

     if turnTuple in Awins:
        print Awins[turnTuple]
        Ascore = Ascore + 1
     elif turnTuple in Bwins:
        print Bwins[turnTuple]
        Bscore = Bscore + 1
     elif turnTuple in Cdraws:
        Dscore = Dscore + 1
        print Cdraws[turnTuple]/CODE]
     ##--------- added  -----------------------------------------
     else:
          print "turnTuple not found", turnTuple
woooee 814 Nearly a Posting Maven

See 7.2 at this link, "Reading and Writing Files". http://docs.python.org/tut/tut.html

woooee 814 Nearly a Posting Maven
while pwdCracked == False:
        charRun = 0
        print "#1", charRun
        if charRun <= 35:
            charRun = charRun + 1
            print "#2", charRun
woooee 814 Nearly a Posting Maven

Try running it using "python program_name". You don't have anything in the file to tell the OS that it should use the python interpreter when running it. "import os" is not a valid bash statement (or a MS Windows statement).

woooee 814 Nearly a Posting Maven

Who would have ever imagined that John McCain will the best choice come this November.

Whoever raises the most money wins. There are exceptions but very few. It appears that the Democrats are spending their money in the primary. So if McCain comes up with a right-wing vice presidential candidate and can tap the very deep right-wing pockets, who knows. McCain is no dummy. When it comes to politics, he's been successful for a long time.

woooee 814 Nearly a Posting Maven

with everybody but themselves going to hell. It's in the Bible!

Where?

woooee 814 Nearly a Posting Maven

Please add "Solved" to the title. As long as you are accessing each verb, you might as well put them in a dictionary. It is indexed so has faster lookups. If you have sentences with periods, then you will have to use string.replace() to eliminate them. Also consider whether or not there will be upper and lower case letters.

verbs_dic={}
for line in open("verbs.txt", "r"):
   line=line.strip()
   verbs_dic[line.lower()]=0
print verbs_dic

for line in open("apol.txt", "r"):
   line = line.strip()
   words_subs = line.split()
   for word in words_subs:
      if word.lower() in verbs_dic:
         print word, line
woooee 814 Nearly a Posting Maven

Insert some print statements to see what is happening. You may have a LF, "\n", at the end of each aPol_data item in which case you will see an extra empty line when printing old, so it doesn't match any word without one. If this is true, you will have to strip() both the aPol file and data from myFile. Depending on the size of the files, it might run faster if you use a dictionary as the container for aPol_data, split the myFile data into words, and lookup each word in the dictionary.

import string, sys, os
import csv

myFile = open("verbs.txt","r")
data = myFile.readlines()
myFile.close()

aPol = open("apol.txt","r")
aPol_data = aPol.readlines()
aPol.close()

for line in data:
    print "line =", line
    for old in aPol_data:
        print "     old =", old
        if old in line:
            print line
woooee 814 Nearly a Posting Maven

First, the following code will explain what I mean by 2 variables named "i". The second x prints out a different value and a different element for x_list. If this code changed for loop value for x to 1, then the loop would never end in this example because x would never get to 5. It, in fact, repeatedly gives a another block of memory named "x" the value of 1.

x=0
x_list=[ 1, 2, 3, 4, 5 ]
for x in range(0, 5):
   print "\nfor loop x =", x, x_list[x]
   x = 1
   print "     2nd x =", x, x_list[x]
   
##-----  output
for loop x = 0 1
     2nd x = 1 2
     
for loop x = 1 2
     2nd x = 1 2
          
for loop x = 2 3
     2nd x = 1 2
               
for loop x = 3 4
     2nd x = 1 2
                    
for loop x = 4 5
     2nd x = 1 2

If you want to subtract one from each element in x, then it would be something like this, assuming that each element is appended/added to y instead of replacing an existing element

def kopi(x,y):
    for each_el in x:
        print "before subtracting", each_el,
        y.append(each_el-1)
        print "  after subtracting", each_el-1
    print y
    return y

If every element in x is not an integer or float, you will get an error when you try to subtract.

woooee 814 Nearly a Posting Maven

The Python Imaging Library has tiff routines. Before beating your head against the wall, see if you can use it. If not, post back with an example or two of what you want to put into the metadata. Image formats have become very optionated.

woooee 814 Nearly a Posting Maven

1) You don't return x from the function so it is not visible outside the function.
2) You have multiple variables named "i" (Please don't use, i, l, or o as they look like numbers and there as 23 other letters that work just as well) for i in range (1,len(x)-1): is one, and i=0, i+=1 is the second.
3) The proper way to add to a list is to use append. Following your original idea

def kopi(x,y):
    for j in range (0, len(x)):
        x.append(y[j])        
    print y

You can also use x=y[:]
If you want x[0] + y then you can do
new_x= []
new_x,append(x[0])
new_x += y
If you want x to be y[1]-->y[len(y)], omitting the first element, you can use z=y[1:].
If this doesn't help, then you will have to be more explicit about "doesn't work". That doesn't say much.

woooee 814 Nearly a Posting Maven

If you want both verb and prep to be found in count created by the existing code

from collections import defaultdict
total_found_dic = defaultdict(int) 
if (verb in count) and (prep in count):
     total_found_dic[(verb, prep)]  += 1

Note that you want to test sub-words and print the results to see what happens. I doubt you are looking for "the", but as an example, searching for "the" may or may not give it hit for the word "they", depending on how the dictionary is arranged.

woooee 814 Nearly a Posting Maven

Are you on a Mac or Linux? Libfmodex if available for both. It appears that you don't have it installed although it could be installed someplace that is not in the path. Try searching/installing fmodex or libfmodex.

woooee 814 Nearly a Posting Maven

Have you tried sys.stdout.flush()? I don't know if that will work or not. Also, you want to begin to move over to the subprocess module. Theoretically, it should flush the buffer whenever you issue a read stdout using subprocess. I guess no one else has much to offer on this. A link to Hellman's subprocess PyMOTW http://blog.doughellmann.com/2007/07/pymotw-subprocess.html

woooee 814 Nearly a Posting Maven

A) Stop feeding it your brains
B) Hint, it's a __carpet__ python.
BTW watt is spelled "watt", not wat, and python's don't eat watts, lightbulbs do.

woooee 814 Nearly a Posting Maven

I think Blade321 also wants to ask for input if the numbers don't agree and assign it to the variable x (instead of printing it)

x=0
y= 1234
n=0
while x <> y:
   x = int(raw_input("Enter a number " ))
   n += 1
   if n > 10:
       break
woooee 814 Nearly a Posting Maven

Append everything to c

a = [ "is", "cool"]
b = ["Peter", "James", "John"]
c = []

for name in b:
   c.append( [name, a]  )
print c

[['Peter', ['is', 'cool']], ['James', ['is', 'cool']], ['John', ['is', 'cool']]]
sneekula commented: very nice solution +3
woooee 814 Nearly a Posting Maven

Using a dictionary or set would be faster than "if not key in list" as they are indexed. "If not key in list" has to traverse the list until it finds a key, or until the end is reached if there is no match. It has to do this every time which makes it inefficient for larger lists. A sort may or may not be faster depending on the sort. But there has been no reponse, so I think we may have tried to go too far too fast and just confused the OP.

woooee 814 Nearly a Posting Maven

You can read the data into a list. As stated above, the following statement is already a list, so no need for the copy.
fdata = open(vhdat).readlines()
If there are 544,000 recs and each rec is 100 bytes, that is 54,400,000 bytes (54 megs) of memory. That's very doable in today's world. Memory is thousands of times faster than disk. Anyway, you then want to sort fdata on whatever fields you define as causing a duplicate. Lets call this the index. Process the list one record at a time, and only add to the SQL file if the index does not equal the previous index. I would suspect that the majority of the time spent is with the SQL file. The word "sort" can mean any number of algorithms, and that will be the time consuming part with 544,000 recs. You probably want to go through the list and place all recs less than "x" in a second list, placing non-x in another list for the next pass, sort the list of "x" recs and process. Increase "x" by some increment, etc, etc. The optimum value for x depends on the length of the record, but test the total time it takes on powers of ten, that is 1000 recs per, 10,000 recs per, and 100.000 recs per, which will tell you the range you want to be in. As a very, very general rule, it is much faster sorting 544 batches of 1000 recs than one batch …

woooee 814 Nearly a Posting Maven

This is a demo found on the web. There may be better ways to do it, but since I don't do much Tk programming, it works fine for me. BTW there is talk of integrating Tile in Python3.0, but so far that is only talk.

from Tkinter import *
 
root = Tk()
root.tk.call('package', 'require', 'tile')
root.tk.call('namespace', 'import', '-force', 'ttk::*')
root.tk.call('::ttk::setTheme', 'alt')
root.geometry("100x50+10+10" )  
v = IntVar()
Radiobutton(root, text="Hello", variable=v, value=1).pack()
Radiobutton(root, text="There", variable=v, value=2).pack()
 
root.mainloop()
woooee 814 Nearly a Posting Maven

Install Tile. Google will give a lot of results about Tile improving Tkinter. Also, try other fonts. I like linux-libertine. This will list the fonts that are available.

from Tkinter import *
from tkFont import families
import Pmw
root = Tk()
Pmw.initialise()

choice = None
comboentries = families(root)

##---  Move from tuple to list and sort
comboentries_list = list(comboentries)
comboentries_list.sort()

label_test = Label(root, text='Test Font',padx=20, pady=10)
label_test.pack(expand=1, fill=BOTH, padx=8, pady=8)

def selectFont(entry):
    label_test.configure(font=(entry,12))

combobox = Pmw.ComboBox(root, label_text='Font:', labelpos='wn',
           listbox_width=24, dropdown=1,
           scrolledlist_items=comboentries_list,
           selectioncommand=selectFont)
combobox.pack(fill=BOTH, expand=1, padx=8, pady=8)
                                                        
combobox.selectitem(comboentries_list[0])
                                                                            
root.mainloop()
woooee 814 Nearly a Posting Maven

I see what you mean. You could of course test for that, but then there would be another set of moves that would always beat the computer. There is probably even a "101 ways to win at tic-tac-toe" book, and you would have to test for all 101 ways. I would guess that this is the point to start keeping track of winning games and losing games so eventually the computer would not make any mistakes. The tic-tac-toe entry on Wikipedia has a slightly different best move strategy. They call your current problem a "fork".

A player can play perfect tic-tac-toe if they choose the move with the highest priority in the following table[4].

1. Win: complete three in a row.
2. Block: block their opponent from completing three in a row
3. Fork: threaten a win with two possible completions in two ways
4. Block Fork:

Option 1: create two in a row to force a block (Note: Sometimes, if one forces a block in this manner, the other player's block will result in a fork and a winning position, so care must be taken when there is more than one way to create two in a row. For example, if X has played the center and a corner, and o is in the opposite corner, o must play a corner and not an edge or else x will win).
Option 2: if there is a configuration where the opponent can fork, block that fork

woooee 814 Nearly a Posting Maven

I was assuming that no one had two in a row. You first want to check for two in a row and if your opponent has it then block, if you have it, win the game. Taking a closer look at your code, it appears that the function computer_move() does just that, but I didn't test it. So I would say, at this point I don't understand what the problem is. Second, if you want to make the computer unbeatable, then you will have to store all losing games: (who started and the number of each move), and not do the same thing again. While you are at it, you could do the same for winning games and try to repeat. On second thought, you only have to keep track of winning games and try to make the same moves for yourself, and different moves if your opponent is on the same track as one of the winning games, which of course would supercede the best_move() function.

woooee 814 Nearly a Posting Maven

Another threading tutorial http://blog.doughellmann.com/2008/01/pymotw-threading_13.html but you probably should be using something like pygame.

woooee 814 Nearly a Posting Maven

I didn't spend a lot of time on the code, but best move should be similiar to legal move. IMHO this should be implemented as a class. That would avoid the gobal variables and make the code cleaner. But you may not have gotten into creating classes yet. Also, the function main() is unnecessary. It is common to use "if __name__ == '__main__':" so that you can both test and reuse functions in the code, but in this case main() serves no purpose.

def legal_moves(board):
    """Create list of legal moves."""
    moves = []
    for square in range(NUM_SQUARES):
        if board[square] == EMPTY:
            moves.append(square)
    return moves
#
#
def best_move(board):
    for square in BEST_MOVES:     ##   BEST_MOVES will have to be global
        if board[square] == EMPTY:
            return square
    return -1
woooee 814 Nearly a Posting Maven

These are quotes for anyone who hasn't heard of Steven Wright.
# "I spilled spot remover on my dog. Now he's gone."
# "I stayed up all night playing poker with tarot cards. I got a full house, and four people died."
# "I'm living on a one-way dead-end street. I don't know how I ever got there."
# "Whenever I fill out an application and it says 'In case of an emergency notify...,' I put Doctor. What the hell is my mother gonna do?"
# "I went into this restaurant that serves you breakfast at any time, so I ordered French toast during the Renaissance."
# "Do you think when they asked George Washington for his ID, he'd just pull out a quarter?"
# "All those who believe in psychokinesis raise my hand."
# "The early bird gets the worm, but the second mouse gets the cheese."
# "I almost had a psychic girlfriend but she left me before we met."
# "OK, so what's the speed of dark?"
# "How do you tell when you're out of invisible ink?"

OK, enough of that.

woooee 814 Nearly a Posting Maven

Assuming we're all still here of course.

I don't know about you but I will be

I was joking about the earth exploding by then (strange that some people who call themselves religious, wish for that) or maybe that the mother of all computer viruses hasn't been unleashed turning internet use into only advertising and spam generation-much more likely. So what is the next end-of-time event after 2012. First came the new millenium, then 2012. I wonder what's next.

woooee 814 Nearly a Posting Maven

No one knows how or why magnets attract and repel.

From the March, 2008 Scientific American: "Then there was the study that questioned the efficacy and purpose of the intensive screening of travelers at airports. The researchers, from Harvard University, the Massachusetts Institute of Technology and the Washington University School of Medicine in St. Louis, note that no scientific evaluation has ever been done of the 'screening tools currently in place.' They ask the arch yet brief question, 'Can you hide anything in your shoes that you cannot hide in your underwear?' And they point out that spending on 'airport security ($9 per passenger) is 1,000 times higher than for railway security ($0.01 per passenger), even though the number of attacks on trains is similar to that in planes.' Which, they explain, is 'analogous to committing mammography resources to screen only the left breast.' "

Also: "In a short item entitled 'A Day in the Life of a Doctor: The Power Point Presentation,' two British physicians reveal the 'the main purpose of a PowerPoint presentation is entertainment. Intellectural content is an unwarranted distraction.' They go on to advise that 'the more lines of writing that can be coerced onto a slide and the smaller the font, the lower the risk of anyone criticising any data which has accidentally been included' and that 'the number of slides you can show in your allotted time is inversely proportional to the number of awkward questions which can be asked at the …

woooee 814 Nearly a Posting Maven

which came first, the chicken or the egg?

Dinosaurs laid eggs, so eggs.

Why does Hawaii have an interstate highway system.

Why do we park on the driveway and drive on the parkway.

woooee 814 Nearly a Posting Maven

My mistake. I missed that itemY is a list. Given that, you could also use sets as they are indexed. It may be also be more trouble than it's worth but is a good exercise. Also, if you don't want "the" to be found if looking at "theo" then you have to split and compare word to word. Assuming that you want to be case sensitive, that is "a" != "A"

## This Has NOT Been Tested
##modifying  Ene Uran's code
def my_f(modelfilename):
    modelfile = open(modelfilename)
    modelline_list = modelfile.readlines()
    modelfile.close()

    itemY = ["lol", "young", "HoLa", "...", "Yum!",
        ":o)", "blokes", "!!!", "hello"]
    itemY_set=set(itemY)

    for line in modelline_list:
         line_set=set(str(line).split())
         if line_set.intersection(itemY_set):
              print "+1 young"
              # not sure if this is what you want?
              return line  
         else:
              print "-1 old"
woooee 814 Nearly a Posting Maven

Just update the label instead of destroy then re-create. Look for the quote that follows at this link http://effbot.org/tkinterbook/label.htm Hopefully that is what you want. If not, my apologies but a dictionary can still be used as it is just a container for the variable, Tkinter.Label or whatever else you may use. I've never tried doing it this way, but you could
self.input_score_dic[m] = Label(frame,width=6) or whatever
self.input_score_dic[m].destory()
self.input_score_dic[m] = None
self.input_score_dic[m] = Label(frame,width=6) with new text

You can associate a Tkinter variable with a label. When the contents of the variable changes, the label is automatically updated:

v = StringVar()
Label(master, textvariable=v).pack()

v.set("New Text!")

woooee 814 Nearly a Posting Maven

First you have to define "equal". If it means any difference at all then first, see if the two files have the same length. If not, then they are not equal, If they are the same length, open each one in binary mode and read a fixed number of bytes from each, then compare for equality. Repeat until the end of file is reached or they are not equal, in which case you can print or return where they differ.

woooee 814 Nearly a Posting Maven

2012 is one of the times for the beginning of the Aquarian age. Pisces (the fish) probably began about 100-200 BC (when Jesus actually lived and ushered in the age-maybe) and so is associated with the Christian religion. In the Bible you find references to the age of Taurus, especially regarding Moses and the golden calf, etc., and I don't remember anything about Aries. We used to get questions about it in the library but not so much anymore. There are several times ranging from the 1960s to 2160 for the age to start. Each age is approximately 2160 years long, so 2160 would the be worst guess because it's just 0 CE to 2160. The 60s is probably too soon. So who knows about 2012. BTW, this is all taken out of context from accounts from before recorded history. These accounts also explain that each age is a sub-period of a larger cycle of 432,000 years. We are about 5,000 years into this larger cycle and so have a long ways to go.

If this thread lasts till the end of 2012, we will have to change the title of it.

Should we all put something in our calendars to post here once a month or so to keep it alive and at the appointed hour have an internet new year's party. Assuming we're all still here of course.

woooee 814 Nearly a Posting Maven

It's time to learn dictionaries as that is the solution to both problems. Give it a try and post back if you can't get something to work. (You are using worstscore twice in the Label but only have to store it once)
self.score_dic["Bill"]=[lastscore, totalscore, worstscore, bestscore]
so self.scores_Bill = self.score_dic["Bill"]
worstscore_Bill=self.scores_Bill[2]
You would never use worstscore_Bill, but would use self.scores_Bill[2] or self.score_dic["Bill"][2]
If you don't use a dictionary, then going beyond a few players gets real tedious real fast.

woooee 814 Nearly a Posting Maven

I saw this solved on another forum. No on wants to waste their time on threads that may have already been solved on another forum. For the future, cross-posted threads will generally get no response.

woooee 814 Nearly a Posting Maven

Perhaps you should state why you want to go around pinging sites. os.popen() is probably not the right tool but that depends on what you are trying to do.

woooee 814 Nearly a Posting Maven

I usually use a dictionary or list

self.input_score_dic={}
for m in range(1, 10):
     self.input_score_dic[m] = Entry(frame,width=6)
woooee 814 Nearly a Posting Maven

You are only checking the first record since you only do one readline(). Add some print statements after the while loop so you can see what you are looking through. If you use readlines(), the entire file will be read into a list

fp = open(modelfilename)
data = fp.readlines()
fp.close()
for modelline in data:
     print "looking for", itemY, "in", modelline
     a = modelline.split()
     if itemY in a:
          print "+1 young"
     else:
          print "-1 old"
woooee 814 Nearly a Posting Maven

Clocked speed must be faster than 5mph and less than 130 mph
What was your clocked speed? 3
Clocked speed must be faster than 5mph

Clocked speed must be faster than 5mph and less than 130 mph
What was your clocked speed? 5

This is indeed how it is supposed to work. The first time the speed was 3, so it prints "Clocked speed must be faster than 5mph", and asks again since the speed wasn't between 5-130. It is the while loop that is doing this, not the if statements. If you enter a speed between 5 & 130 the first time, no message will be printed. It will however print messages as many times as you enter a speed less than 5 or greater than 130.

woooee 814 Nearly a Posting Maven

And the last part should read (I said I was tired)

symbol=substrs[1]  ## not necessary but easier to read
          if symbol in amino_dic:
               amino_dic[symbol] += 1
          else:
               amino_dic[symbol]=1

output will in 21 column,1st column for true false value,others r for 20 amino acids.true false value will be either 1 or -1,and within other 20 coulum one value will be n:1,others will be n:0.n=0,1,2,3..20

Don't understand this statement but it can also be handled with a dictionary of lists, instead of your list of lists.

if symbol not in amino_dic:
               amino_dic[symbol]=[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,]
          amino_dic[symbol] = add one to proper list element
woooee 814 Nearly a Posting Maven

It's late and I'm tired but this is the general idea if I understand correctly

data=["1lghB A i 79.8 H H -24.58",
      "1lghB V i 79.6 H H -22.06",
      "1lghB H i 71.9 H H -19.94"]
for line in data:
     print "\nlooking at", line
     substrs=line.strip().split()
     print  "amino acid =", substrs[1], "and value =", substrs[-1]
     value = abs(float(substrs[-1]))
     if 9.99 < value < 22.01:
          print "greater than 10 and less than 22"
#
# And if you want to keep track of how many hits are found for each
# amino, I would suggest a dictionary with the amino acid symbol 
# as key, containing a simple integer counter, so adding to a
# dictionary the simplest way is:
# (This is still under the if statement)
          if substrs[1] in amino_dic:
               amino_dic += 1
          else:
               amino_dic[substrs[1]]=1

This is what doesn't make sense to me

## what is Z_CORRED
## and you don't define z
for i in Z-CORRED:
if 10.0 <= z <= 22.0:
matches.append([1,i])

And I don't understand all of the print statements. But first, verify that this is the correct way to split the data. Then figure how to store/print it. HTH.

woooee 814 Nearly a Posting Maven

Look at the info on control variables here. You will probably use .set() to set the contents of the entry widget. If you still can't get it to work, post some specific code.
http://infohost.nmt.edu/tcc/help/pubs/tkinter/control-variables.html

woooee 814 Nearly a Posting Maven

I would remove the if statement in that loop, otherwise you print information twice...

It prints separate statements. One if the speed is less than 5 and another if it is greater than 130. The if/elif = (if) (else+if) so at most only one executes. They are there so that nothing is printed for speeds between 5 and 130.

woooee 814 Nearly a Posting Maven

Note that if someone enters anything other than a number, the program will fail, but It doesn't say anything about testing the input so you are probably OK as is. If you have 2 while() loops in a row, then you will have to enter the data twice, once for each loop.

def ask_speed():
    speed = 0
    while (speed < 5) or (speed > 130):
        print "\nClocked speed must be faster than 5mph and less than 130 mph"
        speed = float(input ("What was your clocked speed? "))
        if speed < 5.0:
             print "Clocked speed must be faster than 5mph"
        elif speed > 130:
             print "You know your radar gun doesn't go that high"
    return speed
woooee 814 Nearly a Posting Maven

Add some print statements so you can tell what is going on, such as

convert_table = {1:{0:0}, 2:{0:1}, 3:{0:2},
                4:{1:0}, 5:{1:1}, 6:{1:2},
                7:{2:0}, 8:{2:1}, 9:{2:2}}

yx = convert_table[3]
print yx, type(yx)

There isn't a y, x in yx (convert_table[choice]). It's a dictionary not a list. You'll have to use something else to get this data. Also add more print statements so you know what is going on. Test each function individually, especially the values passed to the functions and the values it returns.

woooee 814 Nearly a Posting Maven

Google for "convert 'base 16'" which will hit on general conversions also. The math is straightforward and on a lot of sites, as well as how letters are used.

woooee 814 Nearly a Posting Maven

Bash will do that for you In Linux. You can also use sys.stdout.write(sys.stdin.read()), although subprocess is now the preferred method. I would guess that on other operating systems it would also be subprocess. This is Doug Hellman's module of the week on subprocess which should get you started http://blog.doughellmann.com/2007/07/pymotw-subprocess.html

woooee 814 Nearly a Posting Maven

Use the show="*" attribute. Also, you are not getting any responses because a Google for "tkinter password" will yield more hits than you can deal with. If this isn't homework, use something found on the web that has already been tested (and is probably written by someone with more Tkinter experience-no offense meant since that includes just about everybody in my case).

woooee 814 Nearly a Posting Maven

A try/except is the only thing that I can think of. Python might not even know what the default browser is since the interpreter probably links to a system resource named defaultbrowser or whatever.