I want to get the base64 image from the def and use them in main init def. So far I have only been able to get one. I'm new to using class and things seem to work differently.
from Tkinter import Tk, Radiobutton, Button
import os, base64
class Select:
def __init__ (self, root):
self.root = root
root.title ('John Shiveley CheckScan Solution')
self.items = {}
appicon = self.myicons
##The Base64 icon version as a string
icon = appicon()
icondata= base64.b64decode(icon)
## The temp file is icon.ico
tempFile= "icon.ico"
iconfile= open(tempFile,"wb")
## Extract the icon
iconfile.write(icondata)
iconfile.close()
root.wm_iconbitmap(tempFile)
os.remove(tempFile)
button1 = Radiobutton (self.root, text = 'Option 1', command = self.option1, value = 1)
button1.grid(row=1,column=0,sticky="nw")
button2 = Radiobutton (self.root, text = 'Option 2', command = self.option2, value = 2)
button2.grid(row=1,column=1,sticky="ne")
b1 = Button (self.root, text = 'Run',width=20, command = self.test)
b1.grid(row=3,column=0, columnspan=2)
self.flag = 0
self.root.mainloop()
def option1 (self):
print ' Option 1'
self.flag = 1
def option2 (self):
print ' Option 2'
self.flag = 2
def test (self):
if self.flag == 1:
print '1st option selected'
elif self.flag == 2:
print '2nd option selected'
else:
print 'No option selected'
def myicons(appicon):
drive = \
"""
Image code
"""
appicon = \
"""
Image code
"""