Kaydet (Commit) 885c0bbd authored tarafından Steven M. Gava's avatar Steven M. Gava

improve viewfile handling

indentation style changed to match existing source
üst 6cd441d1
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
about box for idle about box for idle
""" """
from Tkinter import * from Tkinter import *
import string import string, os
import textView import textView
import idlever import idlever
class AboutDialog(Toplevel): class AboutDialog(Toplevel):
...@@ -116,12 +116,14 @@ class AboutDialog(Toplevel): ...@@ -116,12 +116,14 @@ class AboutDialog(Toplevel):
self.buttonLicense.invoke() self.buttonLicense.invoke()
def ShowLicense(self): def ShowLicense(self):
textView.TextViewer(self,title='About - Readme', self.ViewFile('About - Readme','README.txt')
fileName='./README.txt')
def ShowCredits(self): def ShowCredits(self):
textView.TextViewer(self,title='About - Credits', self.ViewFile('About - Credits','CREDITS.txt')
fileName='./CREDITS.txt')
def ViewFile(self,viewTitle,viewFile):
fn=os.path.join(os.path.abspath(os.path.dirname(__file__)),viewFile)
textView.TextViewer(self,viewTitle,fn)
def Ok(self, event=None): def Ok(self, event=None):
self.destroy() self.destroy()
...@@ -129,5 +131,8 @@ class AboutDialog(Toplevel): ...@@ -129,5 +131,8 @@ class AboutDialog(Toplevel):
if __name__ == '__main__': if __name__ == '__main__':
#test the dialog #test the dialog
root=Tk() root=Tk()
Button(root,text='About',command=lambda:AboutDialog(root,'About')).pack() def run():
import aboutDialog
aboutDialog.AboutDialog(root,'About')
Button(root,text='Dialog',command=run).pack()
root.mainloop() root.mainloop()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment