199 Topics
| |
I have written the following Tkinter script: When I run it, the first thing that happens is the File Dialog box opens without it being called. I am expecting the file dialog box only to open when the "Open Document" button is pressed. import tkinter as tk from tkinter import … | |
Hi all, Have my below program: from tkinter import * from tkinter import ttk from tkinter import messagebox class Application(object): def __init__(self, master): self.master = master qPlacement = IntVar() self.cc = ttk.Combobox(self.master, textvariable=qPlacement, width = 5).place(x = 5, y = 30) Button(self.master, text = 'Click Me', command = self.popCombo).place(x = … | |
I would like to create a custom theme for my app. I can't get the button widget to expand in my code below. I can configure the button using the minimum width parameter but it should expand to fit the text as specified under layout. Any ideas what is wrong … | |
Hi! I am a begineer in programming. I have started to work on the app using tkinter. I would like to add a contact form (similar to Django) to my app so a user can send me a message with queries. This message would be sent to my email address. … | |
Hello, I am learning Tkinter. As a part of the learning process I am building a Notepad clone in order to become familiar with Tkinter widgets. I am pretty close to completing it - I added about 90% functionality to the application - but I face two problems: 1) The … | |
A simple way to create a toggle button for the Tkinter Python GUI toolkit. | |
Shows how to create a basic slide show with the Python Tkinter GUI toolkit. | |
This is one small snippet of after event usage. You could express if you find this kind of simple code to be usefull as snippet. Notice also vegaseat's sticky message threads in begining of Python forum in addition to code snippets. | |
Hi all, Ive been looking to convert one of my programs to include a GUI, and am having issues with the timing aspects of it. Ive included a mock scenario of what my problem is below: Ive defined my GUI as an object via a class, and am using the … | |
Hi guys, I'm new to Python have get done a lot by searching. Now I try to bind a scroll wheel to canvas, but it doesn't do anything. Will someone look at the code what I do wrong? I tried to keep my snippet clean. Hope It's enough. class Viewer(tk.Toplevel): … | |
Hello, it is me once more. I am using Python 2.3, and I must use Zelle's graphics class (and I must agree with many of you. Tkinter is much better). We have been tasked with creating a Graphical Scientific Calculator. In addition to the normal operators, it must contain the … | |
The Tkinter GUI toolkit comes with a scrolled text widget that is called ScrolledText. To get access to it you have to import it separately. It allows you to display large amounts of text in a small space. | |
If you have a long message to display in a large readable font, then this little Tkinter GUI toolkit code might help. | |
This simple key logger shows any character/special key when pressed. | |
Fair warning - I'm still learning so this might be a very newb like question: What I'm trying to do: I'm trying to import a python file into a Tkinter window and run it when I press a button. Eventually I'd like to display the output of the imported script … | |
I have no idea how to create a Gui from another Gui using python. What I have so far is simply a basic Gui which you select one of the options from a dropdown menu and create another Gui. Here's what I have so far... import sys from tkinter import … | |
I found that one can use dictionaries to hold Tkinter widget config and display parameters. This then permits one to have these dictionaries elsewhere in the code for easy modification instead of buried within the code for each widget. I particularly like to place these dictionaries toward the top of … | |
This is the updated version of the Tiny Tkinter Calculator. It has more power, since you can type in functions contained in the Python math module then press the equals key. You can then move the result into memory for other calculations. The code is written in OOP class style … | |
I would like the widgets on the window to expand as you expand the window. I know you can do it with the pack method but I'm using the grid method to arange my widgets. Pack Method: label = Label(root, text="Some Text") label.pack(expand=1, fill=BOTH) Grid Method I'm using: self.inventoryLabel = … | |
I needed a calculator and I didn't want to use google since my internet is slow. So I made one! Here it is. Working with it is simple. Use the number and operation keys("c" for clear, "p" for pi, and "s" for sqrt) as well as the return and enter … | |
I am implementing the last feature of my Python Checkers Game, which is to require the user to make multiple jumps. For captures, I do the following: 1 Check if the move is valid: 2 self.validatedMove = True (The move that has been made is valid.) 3 self.capture() (Captures the … | |
This 'sticky' thread is for working examples of Python GUI code. Note that most wxPython examples have their own thread. Please use comments in your code to help the reader. The example code should be usable as a template, so folks get a feel for the toolkit and can use … | |
I have a tkinter app that has 2 frames. The frame on the left has a bunch of buttons and the frame on the right has a text widget. I use the create_buttons function below to make the buttons. Is there a way to have the button stay sunken when … | |
Sometimes it's easier to pick an image from the internet to display in your Python Tkinter GUI toolit program. | |
import tkinter from tkinter import ttk top=tkinter.Tk() top.title("Scoreboard") top.configure(background="black") w=ttk.Scrollbar(top,orient='vertical') l1=tkinter.Label(top,height=2,width=67,bd=4,text="Welcome To Cricket World Cup 2015",font=("Purisa",15),fg="white",bg="red",relief="ridge") l1.grid(row=0,column=0,columnspan=67) l2=tkinter.Label(top,height=2,width=25,font=("Purisa",15),text="India",fg="white",bg="red",relief="ridge") l2.grid(row=1,column=0) l3=tkinter.Label(top,height=2,width=15,font=("Purisa",12),text="VS",fg="white",bg="black") l3.grid(row=1,column=1) l4=tkinter.Label(top,height=2,width=25,font=("Purisa",15),text="Australia",fg="white",bg="red",relief="ridge") l4.grid(row=1,column=2) l5=tkinter.Label(top,height=9,width=67,bd=4,font=("Purisa",15),bg="red",relief="ridge") l5.grid(row=3,column=0,columnspan=67) l6=tkinter.Label(top,height=2,width=15,font=("Purisa",12),text="India",fg="white",bg="Black",relief="ridge") l6.grid(row=3,column=0,rowspan=1,sticky="NW") l7=tkinter.Label(top,height=3,width=14,font=("Purisa",20),text="183/2",fg="white",bg="Black",relief="ridge") l7.grid(row=3,column=0) l8=tkinter.Label(top,height=3,width=14,font=("Purisa",20),text="45.1",fg="white",bg="Black",relief="ridge") l8.grid(row=3,column=2) l9=tkinter.Label(top,height=3,width=20,font=("Purisa",12),text="RR = 4.057 ",fg="white",bg="Black",relief="ridge") l9.grid(row=3,column=1,rowspan=1) l10=tkinter.Label(top,height=2,width=15,font=("Purisa",12),text="Toss = Australia",fg="white",bg="Black",relief="ridge") l10.grid(row=3,column=2,rowspan=1,sticky="NE") l11=tkinter.Label(top,height=7,width=67,bd=4,font=("Purisa",15),bg="red",relief="ridge") l11.grid(row=6,column=0,columnspan=67) l12=tkinter.Label(top,height=2,width=13,font=("Purisa",20),text="Player name",fg="white",bg="Black",relief="ridge") l12.grid(row=6,column=0,sticky="NWE") l13=tkinter.Label(top,height=2,width=12,font=("Purisa",20),text="Balls",fg="white",bg="Black",relief="ridge") l13.grid(row=6,column=2,sticky="NEW") l14=tkinter.Label(top,height=2,width=11,font=("Purisa",20),text="Runs",fg="white",bg="Black",relief="ridge") l14.grid(row=6,column=1,sticky="NWE") l15=tkinter.Label(top,height=1,width=10,font=("Purisa",14),text="44",fg="white",bg="Black",relief="ridge") … | |
Hello, I have this code which is working import Tkinter as tk from Tkinter import * LARGE_FONT= ("Verdana", 12) class ChangePages(tk.Tk): def __init__(self, *args, **kwargs): tk.Tk.__init__(self, *args, **kwargs) container = tk.Frame(self) container.pack() container.grid_rowconfigure(0, weight=1) container.grid_columnconfigure(0, weight=1) self.frames = {} for F in (MainPage, Page01, Page02): frame = F(container, self) self.frames[F] … | |
I have a Tkinter GUI that is composed of two widgets, the first is a widget class with an entry field and a button and the second is a scrollable text widget class. I have combined these two widget classes to make a single GUI. Each of these widget classes … | |
Hello. I have a Class in my python file. That Class contains some functions. How can i set the command of a Tkinter butten so that call a function of that class? I tried this but it didn't work: class calculating(object): def __inint__(self): self.current = 0 def addition(self, amount): self.current … | |
How can i create a drop-down menu in Tkinter? | |
Hi everybody. I have problem with .pack() and .grid(). I have to use this line: mywin.pack(fill=BOTH, expand=YES) I have used .grid every where on my file but now here i have copied a pice of code from some where and have pasted to my file, as you see it has … |
The End.