B
Bugcy 013
Dear all,
I am new to python programming, I am developing some small
application, user agreement using Tkinter ,
totally my application having four buttons AGREE, DISAGREE , QUIT ,NEXT.
AGREE--->>Enable the Next Button
DISAGREE--->> One Waring message will show up yes are no
QUIT ---->> Quit the application
Next -->>Calling one python script exit the GUI
I have created application all working fine button will show up the
top of the screen..
i want show bottom of the frame... plz... Help me...
<code>
#! /usr/bin/python
from Tkinter import Tk, RIGHT, BOTH, RAISED
from ttk import Frame, Button, Style
import sys
import os
sys.path[:0] = ['../../..']
import string
import Tkinter
import Pmw
import wx
from Tkinter import *
import tkMessageBox
import gtk
b1 = 'True'
c1 = 'False'
a1 = 1
class Example(Frame):
def __init__(self1, parent):
Frame.__init__(self1, parent)
self1.parent = parent
self1.initUI()
#fixedFont = Pmw.logicalfont('Fixed')
self1.st = Pmw.ScrolledText(parent,
labelpos = 'n',
label_text='User Aggrement',
usehullsize = 1,
hull_width = 600,
hull_height = 400,
text_wrap='none',
#text_font = fixedFont,
text_padx = 4,
text_pady = 4,
)
self1.st.importfile('python.txt');
self1.st.pack(padx = 5, pady = 5, fill = 'both', expand = 1)
# Prevent users' modifying text and headers
self1.st.configure(text_state = 'disabled')
def initUI(self1):
self1.parent.title("User Aggrement")
self1.style = Style()
self1.style.theme_use("default")
frame = Frame(self1, relief=RAISED, borderwidth=.5)
frame.pack(fill=BOTH, expand=1)
self1.pack(fill=BOTH, expand=1)
def buttonPress(var):
#print 'The "%s" button was pressed' % var
if var == 'ok':
#os.system("ls -l") & os.system("man man")
widget.configure(state=NORMAL)
elif var == 'dhana':
os.system("top") & exit()
elif var == 'close':
a1 = tkMessageBox.askyesno("DisAgree", "Do you
really wish to Disagree?" )
#print a1
if a1 == 1:
exit()
else:
sys.exit
widget = Tkinter.Button(self1, text='Next',command = lambda
b='dhana': buttonPress(b) )
widget.pack(side=RIGHT, padx=5, pady=5)
widget.configure(state=DISABLED )
def defaultKey(event):
def make_widgets(self1):
buttonBox.invoke()
self1.make_widgets()
root = Tkinter.tk()
okButton = Tkinter.Button(self1, text="Quit",command =
sys.exit , font=('Arial', 10), fg="black")
okButton.pack(side=RIGHT, padx=5, pady=5)
CloseButton = Tkinter.Button(self1, text="DisAgree",command =
lambda b='close': buttonPress(b) , font=('Arial', 10), fg="black")
CloseButton.pack(side=RIGHT, padx=5, pady=5)
okButton = Tkinter.Button(self1, text="Agree",command = lambda
b='ok': buttonPress(b) , font=('Arial', 10), fg="black")
okButton.pack(side=RIGHT, padx=5, pady=5)
okButton.focus_force()
#self1.mainloop()
########################################################################################################################################
def main():
root = Tkinter.Tk()
root.geometry("600x400+30+30")
app = Example(root)
root.mainloop()
if __name__ == '__main__':
main()
</code>
I am new to python programming, I am developing some small
application, user agreement using Tkinter ,
totally my application having four buttons AGREE, DISAGREE , QUIT ,NEXT.
AGREE--->>Enable the Next Button
DISAGREE--->> One Waring message will show up yes are no
QUIT ---->> Quit the application
Next -->>Calling one python script exit the GUI
I have created application all working fine button will show up the
top of the screen..
i want show bottom of the frame... plz... Help me...
<code>
#! /usr/bin/python
from Tkinter import Tk, RIGHT, BOTH, RAISED
from ttk import Frame, Button, Style
import sys
import os
sys.path[:0] = ['../../..']
import string
import Tkinter
import Pmw
import wx
from Tkinter import *
import tkMessageBox
import gtk
b1 = 'True'
c1 = 'False'
a1 = 1
class Example(Frame):
def __init__(self1, parent):
Frame.__init__(self1, parent)
self1.parent = parent
self1.initUI()
#fixedFont = Pmw.logicalfont('Fixed')
self1.st = Pmw.ScrolledText(parent,
labelpos = 'n',
label_text='User Aggrement',
usehullsize = 1,
hull_width = 600,
hull_height = 400,
text_wrap='none',
#text_font = fixedFont,
text_padx = 4,
text_pady = 4,
)
self1.st.importfile('python.txt');
self1.st.pack(padx = 5, pady = 5, fill = 'both', expand = 1)
# Prevent users' modifying text and headers
self1.st.configure(text_state = 'disabled')
def initUI(self1):
self1.parent.title("User Aggrement")
self1.style = Style()
self1.style.theme_use("default")
frame = Frame(self1, relief=RAISED, borderwidth=.5)
frame.pack(fill=BOTH, expand=1)
self1.pack(fill=BOTH, expand=1)
def buttonPress(var):
#print 'The "%s" button was pressed' % var
if var == 'ok':
#os.system("ls -l") & os.system("man man")
widget.configure(state=NORMAL)
elif var == 'dhana':
os.system("top") & exit()
elif var == 'close':
a1 = tkMessageBox.askyesno("DisAgree", "Do you
really wish to Disagree?" )
#print a1
if a1 == 1:
exit()
else:
sys.exit
widget = Tkinter.Button(self1, text='Next',command = lambda
b='dhana': buttonPress(b) )
widget.pack(side=RIGHT, padx=5, pady=5)
widget.configure(state=DISABLED )
def defaultKey(event):
def make_widgets(self1):
buttonBox.invoke()
self1.make_widgets()
root = Tkinter.tk()
okButton = Tkinter.Button(self1, text="Quit",command =
sys.exit , font=('Arial', 10), fg="black")
okButton.pack(side=RIGHT, padx=5, pady=5)
CloseButton = Tkinter.Button(self1, text="DisAgree",command =
lambda b='close': buttonPress(b) , font=('Arial', 10), fg="black")
CloseButton.pack(side=RIGHT, padx=5, pady=5)
okButton = Tkinter.Button(self1, text="Agree",command = lambda
b='ok': buttonPress(b) , font=('Arial', 10), fg="black")
okButton.pack(side=RIGHT, padx=5, pady=5)
okButton.focus_force()
#self1.mainloop()
########################################################################################################################################
def main():
root = Tkinter.Tk()
root.geometry("600x400+30+30")
app = Example(root)
root.mainloop()
if __name__ == '__main__':
main()
</code>