To kick this off, i am a complete noob at programming in general; and i learn best by DOING rather than reading.
I am writing a basic program with Python using a GUI through VB.
I have only been using python for a few hours, so i don't have a great understanding of the basic strings.
Can someone point out why i am getting this error?
(TypeError: 'int' object does not support item assignment)
My code is below. There are three buttons that do nothing, then a fourth that will serve as my counter.
All i wish to do is make the button count how many times i click it.
I am putting notes around, so that i can remind myself what im doing.
Any help or pointers is much appreciated! I plan to end up (Not basing it on this program) to create a GUI for a set of .py scripts that someone else already has, in order to be usable on a small Raspberry Pi based device with a touchscreen. Any pointers to the best way to incorporate other .py scripts would also be very helpful!
#Creating a GUI using a Class string
from tkinter import *
#Initiate the Frame
def __init__(self, master):
self.button_clicks =0 #Counting number of button clicks
#Create a button
self.button1 = Button(self, text = "This is a button")
self.button2 = Button(self)
self.button2.configure(text = "This is another button")
self.button3 = Button(self)
self.button3["text"] = "This is a third button"
#Creating a button to count clicks
self.button4 = Button (self)
self.button4["text"] = "Total Clicks : 0"
self.button4["command"] = self.update_count
self.button_clicks += 1
self.button_clicks["text"] = "Total Clicks : " + str(self.button_clicks)
root = Tk()
root.title("This is a GUI")
app = Application(root)