Category : tkinter

I got another little question… I want to make multiple variables which I create with ‘setattr’ That works quite fine. It creates these variables: self.sectionButton_1 = Button(text=x) self.sectionButton_2 = Button(text=x) self.sectionButton_3 = Button(text=x) Now I want them to get displayed on the window with tkinter so that this should happen: self.sectionButton_1.grid(row=i, column=0) self.sectionButton_2.grid(row=i, column=0) and ..

Read more

I’m trying to make a tkinter script that will print a lot of buttons with functions like this. from tkinter import * def printbutton(x:int): print(x) root = Tk() root.geometry(‘500×500’) for x in range(1,100): Button(root, text = str(x), command = lambda:printbutton(x)).pack(side="left") root.mainloop() But it print all button in a line and expanded outside of my GUI. ..

Read more

I am trying to use hyperlinks in tkinter. I found this Stack Overflow question , but this would make every part of the text a link. I want to create something like this (on the window): This is Google:Google. I am using insert for the text, so I tried text_area.insert(‘end’, ‘Google’, ‘n’).bind("<Button-1>", lambda e: google()). ..

Read more

I’m trying to make a button where it will start a program. So first, a button called ‘Run’ will appear, subsequently after 3 seconds it should come up with a new button that says ‘Stop’. The reason I want it that way. That it’s because I have tried and add two buttons on an interface ..

Read more

import tkinter as tk from tkinter import ttk root = tk.Tk() root.title("Tic Tac Toe") root.geometry("505×500") root.resizable(0,0) Blank = tk.PhotoImage(file=’Blank.png’) X = tk.PhotoImage(file=’X.png’) O = tk.PhotoImage(file=’O.png’) def configB(event): print(‘hello’) btn1 = tk.Button(root,image=Blank) btn1.place(x=0,y=0) btn2 = ttk.Button(image=Blank) btn2.place(x=165,y=0) btn3 = ttk.Button(image=Blank) btn3.place(x=330,y=0) btn4 = ttk.Button(image=Blank) btn4.place(x=0,y=165) btn5 = ttk.Button(image=Blank) btn5.place(x=165,y=165) btn6 = ttk.Button(image=Blank) btn6.place(x=330,y=165) btn7 = ttk.Button(image=Blank) ..

Read more