[Tkinter-discuss] scrollbar

Guilherme Polo ggpolo at gmail.com
Mon Jun 30 14:41:03 CEST 2008


On Sun, Jun 29, 2008 at 6:34 PM, EDWINFMI <egpalma at hotmail.com> wrote:
>
> hy guys i am developing a  simple script by using tkinter, but i do not  know
> how to include a scrollbar
> some ideas

I stopped reading right at "import Pmw", mainly because your email is
too lenghty. There is a demo at bottom here:
http://pmw.sourceforge.net/doc/ScrolledFrame.html which solves your
problem supposing you need a ScrolledFrame.
If it is not a ScrolledFrame that you need, resend the email with a
question and a /short/ code that demonstrates what you tried and how
it fails.

>
> from Tkinter import *
> import tkMessageBox
> import grail
> import Pmw
>
> #==========================================================
> def read_economic_parameters():
>    print "no yet"
> #===========================================================
> root = Tk()
> root.option_add('*Font', 'Verdana 10')
> root.title('Economic Model Sierrita, Freeport McMoran')
> root.geometry('700x900')
> Pmw.initialise()
>
>
> frame = Frame(root, width=500, height=400, bd=1)
> frame.pack()
>
> lw = Pmw.LabeledWidget(frame, labelpos='n', label_text='ECONOMIC BLOCK
> MODEL')
> lw.component('hull').configure(relief=SUNKEN, borderwidth=3)
> lw.pack(padx=10, pady=10)
> img = PhotoImage(file='LOGO.gif')
> cw = Button(lw.interior(), background='yellow', image=img)
> cw.pack(padx=10, pady=10, expand=1, fill=BOTH)
>
>
> button = Button(root,text="Accept",fg="red",
> command=read_economic_parameters)
> button.pack()
>
> iframe3 = Frame(frame, bd=2, relief=SUNKEN)
> Label(iframe3, text='Metal Price',bg='gray40',font='Verdana 10 bold').pack()
>
> PAR17  = Pmw.EntryField(iframe3, labelpos=W,    value = '1.225',
>                label_text = 'Price Cu TCu $/LB',
>                validate = {'validator' : 'real'})
>
>
> PAR18  = Pmw.EntryField(iframe3, labelpos=W,    value = '6.5',
>                label_text = 'Price Mo $/LB',
>                validate = {'validator' : 'real'})
>
> PAR19  = Pmw.EntryField(iframe3, labelpos=W,    value = '1.225',
>                label_text = 'Price LEACH LCU2 $/LB',
>                validate = {'validator' : 'real'})
> iframe3.pack(expand=1, fill=X, pady=10, padx=5)
>
>
> iframe4 = Frame(frame, bd=2, relief=SUNKEN)
> Label(iframe4, text='Recovery',bg='gray40',font='Verdana 10 bold').pack()
> PAR9  = Pmw.EntryField(iframe4, labelpos=W,     value = '0',
>                label_text = 'Recovery TCu (FRACTION)',
>                validate = {'validator' : 'real'})
> PAR10  = Pmw.EntryField(iframe4, labelpos=W,    value = '0',
>                label_text = 'Recovery Mo (FRACTION)',
>                validate = {'validator' : 'real'})
> PAR12  = Pmw.EntryField(iframe4, labelpos=W,    value = '0.85',
>                label_text = 'Recovery LCu (FRACTION)',
>                validate = {'validator' : 'real'})
> PAR11  = Pmw.EntryField(iframe4, labelpos=W,    value = '0.85',
>                label_text = 'Recovery OX2 (FRACTION)',
>                validate = {'validator' : 'real'})
>
> PAR33  = Pmw.EntryField(iframe4, labelpos=W,    value = '0.965',
>                label_text = 'Smelter Recovery M1 (FRACTION)',
>                validate = {'validator' : 'real'})
>
> PAR34  = Pmw.EntryField(iframe4, labelpos=W,    value = '0.9801',
>                label_text = 'Smelter Recovery M2 (FRACTION)',
>                validate = {'validator' : 'real'})
>
> PAR31  = Pmw.EntryField(iframe4, labelpos=W,    value = '0.037',
>                label_text = 'FIXED TAIL FOR MILL CU (FRACTION)',
>                validate = {'validator' : 'real'})
>
> PAR32  = Pmw.EntryField(iframe4, labelpos=W,    value = '0.0053',
>                label_text = 'FIXED TAIL FOR MILL MO (FRACTION)',
>                validate = {'validator' : 'real'})
> iframe4.pack(expand=1, fill=X, pady=10, padx=5)
>
> iframe5 = Frame(frame, bd=2, relief=SUNKEN)
> Label(iframe5, text='Mining Cost',bg='gray40',font='Verdana 10 bold').pack()
> PAR22  = Pmw.EntryField(iframe5, labelpos=W,    value = '1.112',
>                label_text = 'Mining Cost M1 $/TON',
>                validate = {'validator' : 'real'})
> PAR23  = Pmw.EntryField(iframe5, labelpos=W,    value = '0',
>                label_text = 'Mining Cost M2 $/TON',
>                validate = {'validator' : 'real'})
> PAR24  = Pmw.EntryField(iframe5, labelpos=W,    value = '1.112',
>                label_text = 'Mining Cost OX1 $/TON',
>                validate = {'validator' : 'real'})
>
> PAR25  = Pmw.EntryField(iframe5, labelpos=W,    value = '0',
>                label_text = 'Mining Cost OX2 $/TON',
>                validate = {'validator' : 'real'})
>
> PAR26  = Pmw.EntryField(iframe5, labelpos=W,    value = '1.112',
>                label_text = 'Mining Cost WASTE $/TON',
>                validate = {'validator' : 'real'})
>
> PAR27  = Pmw.EntryField(iframe5, labelpos=W,    value = '0.0145',
>                label_text = 'Variable Waste Cost per Bench $/TON',
>                validate = {'validator' : 'real'})
> PAR13  = Pmw.EntryField(iframe5, labelpos=W,    value = '0.0145',
>                label_text = 'Variable M1 Cost per Bench $/TON',
>                validate = {'validator' : 'real'})
> PAR15  = Pmw.EntryField(iframe5, labelpos=W,    value = '0.0145',
>                label_text = 'Variable OX1 Cost per Bench $/TON',
>                validate = {'validator' : 'real'})
>
> iframe5.pack(expand=1, fill=X, pady=10, padx=5)
>
> iframe6 = Frame(frame, bd=2, relief=SUNKEN)
> Label(iframe6, text='Processing Cost',bg='gray40',font='Verdana 10
> bold').pack()
> PAR1  = Pmw.EntryField(iframe6, labelpos=W,     value = '3.465',
>                label_text = 'Processing Cost M1 $/TON',
>                validate = {'validator' : 'real'})
> PAR2  = Pmw.EntryField(iframe6, labelpos=W,     value = '0',
>                label_text = 'Processing Cost M2 $/TON',
>                validate = {'validator' : 'real'})
> PAR3  = Pmw.EntryField(iframe6, labelpos=W,     value = '0.733',
>                label_text = 'Processing Cost OX1 $/TON',
>                validate = {'validator' : 'real'})
>
> PAR36  = Pmw.EntryField(iframe6, labelpos=W,    value = '1364',
>                label_text = 'Moly Flotation Cost Cu Conc. $/TON',
>                validate = {'validator' : 'real'})
>
> PAR37  = Pmw.EntryField(iframe6, labelpos=W,    value = '0.213',
>                label_text = 'Full Moly Flotation Cost per POUND Mo, for Mo Factor Calc
> $/LB',
>                validate = {'validator' : 'real'})
>
>
> iframe6.pack(expand=1, fill=X, pady=10, padx=5)
>
> iframe7 = Frame(frame, bd=2, relief=SUNKEN)
> Label(iframe7, text='Unit Cost',bg='gray40',font='Verdana 10 bold').pack()
> PAR5  = Pmw.EntryField(iframe7, labelpos=W,     value = '0.3286',
>                label_text = 'Unit Cost M1 $/LB',
>                validate = {'validator' : 'real'})
> PAR6  = Pmw.EntryField(iframe7, labelpos=W,     value = '0.691',
>                label_text = 'Unit Cost M2 $/LB',
>                validate = {'validator' : 'real'})
> PAR7  = Pmw.EntryField(iframe7, labelpos=W,     value = '0.79',
>                label_text = 'Unit Cost OX1 $/LB',
>                validate = {'validator' : 'real'})
>
> iframe7.pack(expand=1, fill=X, pady=10, padx=5)
>
>
> widgets1 = (PAR5, PAR6,PAR7,PAR17, PAR18, PAR19,PAR9,
> PAR10,PAR12,PAR11,PAR33,PAR34,PAR31,PAR32,PAR22,
> PAR23,PAR24,PAR25,PAR26,PAR27,PAR13, PAR15,PAR1, PAR2,PAR3, PAR36, PAR37)
>
> for widget in widgets1:
>    widget.pack(fill=X, expand=1, padx=10, pady=5)
>
> Pmw.alignlabels(widgets)
> real.component('entry').focus_set()
>
>
> root.mainloop()
>
>
> --
> View this message in context: http://www.nabble.com/scrollbar-tp18185599p18185599.html
> Sent from the Python - tkinter-discuss mailing list archive at Nabble.com.
>
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>



-- 
-- Guilherme H. Polo Goncalves


More information about the Tkinter-discuss mailing list