My code will not read the input from the checkboxlabel named text, i want to use the input from text as a variable and do actions with it.
I do not understand the "var1.get()" function. Anyone know how yo get the text valua if checkted out of the box and use it as var?
I Googlen onvar.get() functie and youtube but no answers.
from easygui import *
from Tkinter import *
import Tkinter as tk
import sys
import webbrowser
import easygui
import smtplib
import datetime
from matplotlib import pyplot as plt
from matplotlib import style
import matplotlib.dates as mdates
import numpy as np
import csv
from PIL import Image, ImageTk
from ttk import Frame, Button, Style
import time
import urllib
import base64
root = Tk()
deprifinvar=''
def depri(deprifinvar):
x=0
for x in range (5):
#opencsv = [lijstcsv[x] for x in lijstcsv]
print lijstcsv[x]
print var1.get()
saveFile = open(lijstcsv[x],'U')# leest rij
for row in saveFile:
cols = row.split(';')
#print cols[0]
if (cols[0])== var1.get():
#advies = [cols[1] for x in lijstcsv]
#doelfin(deprifinvar)
print(cols[0])
print(cols[1])
#print advies
saveFile.close()
master = Tk()
score = 0
var1 = IntVar()
def teller():
global score
totaalscore = score + 1
print(totaalscore)
score=totaalscore
return score
def var_states():
print("1: %d,2: %d" %(var1.get() , var2.get() ))
Label(master, text="kolom nummer?").grid(row=0, sticky=W)
x = 0
var1 = IntVar()
Checkbutton(master, text="1", variable=var1,command=teller).grid(row=1, sticky=W)
var2 = IntVar()
Checkbutton(master, text="2", variable=var2,command=teller).grid(row=2, sticky=W)
Button(master, text='Verder', command=master.quit).grid(row=32, sticky=W, pady=4)
#Button(master, text='Stoppen', command=self.showImg()).grid(row=32, sticky=W, pady=5)
mainloop()
if score > 0 and score < 5:
var_states()
lijstcsv=["depri.csv","doelfin.csv","taakfin.csv", "actfin.csv", "pal.csv"]
depri(deprifinvar)
Aucun commentaire:
Enregistrer un commentaire