Adde21_30 Adde21_30 - 1 year ago 435
Python Question

Python TypeError: set() missing 1 required positional argument: 'value'

It tells me "TypeError: set() missing 1 required positional argument: 'value'" and I am really new so I can't figure out what I did wrong. When using pyCharm and hovering over the argument in set() it says "Expected type 'Variable', got 'int' instead". I don't know what that means. Here's the code:

from tkinter import *
var = StringVar
hoho = 0
master = Tk()
var.set (hoho)
photo = PhotoImage(file="C:\\Users\\josa\\Downloads\\Kappa.pmm")
w = Label(image=photo) = photo
w = Label(master, text=var, )


PS: sorry for asking a question that might seem dumb

Answer Source

following line is missing ()

var = StringVar()

And creation of StringVar should be done after creating root windows:

master = Tk()
var = StringVar()
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download