For weeks I try to get my application scrollbar. But there is a conflict with the TKinter-modules and I don't know how to fix it. Without my modules it is scrollbar but not with them. Can you help me please with this examples out of my application?
Lovespock
Ps. Please be nice, I am a half-newbie. :/ :p PPs. My code without textdefinitions and all radiobuttons
from __future__ import print_function
from Tkinter import *
import Tkinter as tk
from result import *
master = tk.Tk()
frame=Frame(master,width=300,height=300)
frame.pack
canvas=Canvas(frame,bg='#FFFFFF',width=300,height=300,scrollregion=(0,0,500,500))
vbar=Scrollbar(frame,orient=VERTICAL)
vbar.pack(side=RIGHT,fill=Y)
vbar.config(command=canvas.yview)
def sumlist():
sum = (vallist_a[-1]) + (vallist_b[-1]) + (vallist_c[-1]) + (vallist_d[-1]) + (vallist_e[-1]) + (vallist_f[-1]) + (vallist_g[-1]) + (vallist_h[-1]) + (vallist_i[-1])
print (sum)
def create_window(): #Definion und Festlegung neues Fenster
toplevel = Toplevel()
toplevel.title('result')
toplevel.geometry('1500x1000')
toplevel.focus_set()
sum = (vallist_a[-1]) + (vallist_b[-1]) + (vallist_c[-1]) + (vallist_d[-1]) + (vallist_e[-1]) + (vallist_f[-1]) + (vallist_g[-1]) + (vallist_h[-1]) + (vallist_i[-1])
if 9<= sum <= 14:
msg = Message(toplevel, text = result1)
msg.config(bg='lightgreen', font=('times', 24, 'italic'))
msg.pack()
if 15<= sum <= 21:
msg = Message(toplevel, text = result2)
msg.config(bg='lightgreen', font=('times', 24, 'italic'))
msg.pack()
if 22<= sum <= 28:
msg = Message(toplevel, text = result3)
msg.config(bg='lightgreen', font=('times', 24, 'italic'))
msg.pack()
if 29<= sum <= 36:
msg = Message(toplevel, text = result4)
msg.config(bg='lightgreen', font=('times', 24, 'italic'))
msg.pack()
def ShowChoice(text, v, testlist):
print(v.get())
testlist.append(v.get())
vallist_a = []
vallist_b = []
vallist_c = []
vallist_d = []
vallist_e = []
vallist_f = []
vallist_g = []
vallist_h = []
vallist_i = []
hello = [
(1),
(2),
(3),
(4),
]
officer = [
(1),
(2),
(3),
(4),
]
borg = [
(1),
(2),
(3),
(4),
]
vulcans = [
(1),
(2),
(3),
(4),
]
home = [
(1),
(2),
(3),
(4),
]
crew = [
(1),
(2),
(3),
(4),
]
important = [
(1),
(2),
(3),
(4),
]
take = [
(1),
(2),
(3),
(4),
]
bye = [
(1),
(2),
(3),
(4),
]
tk.Label(canvas, text='Which Captain are you?', font=("Helvetica", 30), fg = 'red').pack()
varhello = tk.IntVar()
for i, val in enumerate(hello):
tk.Radiobutton(canvas, text=text[i], variable=varhello, value=val,
command=lambda t=text, a=varhello: ShowChoice(t, a, vallist_a)).pack(anchor=tk.N)
Button(canvas, text='forward', command=create_window).pack(padx=5, anchor=N, pady=4)
canvas.config(width=300,height=300)
canvas.config(yscrollcommand=vbar.set)
canvas.pack(side=LEFT,expand=True,fill=BOTH)
master.mainloop()