tkinter

How to give permission to other PC to add data to my database in MySQL.in my computer

强颜欢笑 提交于 2021-02-17 07:03:26
问题 I made a python program here and i wanted to send the code to my friend and he was unable to add values through the program to my database, is there a way i can allow his access. Code: from tkinter import * import mysql.connector as mysql root = Tk() def flush(*args): name = nme.get() phone = ph.get() emirate = e_id.get() con = mysql.connect(host='127.0.0.1', user='root', password='monkey123', database='NZ') c = con.cursor() c.execute("Insert into gliy VALUES ('"+name+"','"+str(phone)+"','"

Dynamic resizing of image using PIL and tkinter

风格不统一 提交于 2021-02-17 06:34:32
问题 I wanted to know if it was possible to resize the image dynamically(maintaining its aspect ratio). I made an image viewer app, but then the vertically long images overflow the screen, so i wanted to know a method to resize image, ive tried a way and its included below. But still im getting the same output that overflows the screen. from win32api import GetSystemMetrics from tkinter import * screen_width, screen_height = GetSystemMetrics(0), GetSystemMetrics(1) root = Tk() # this is your

How to draw a right angle triangle using tkinter?

谁说我不能喝 提交于 2021-02-17 05:52:25
问题 I'm trying to draw a right angle triangle with tkinter. I can't figure out how to do it, I can do a rectangle and then another one but I cant get the second rectangle to be a triangle. Here's an example of what I want to do, how far I have gotten, and my code: What I want to do: How far I've gotten: My code: from tkinter import * root= Tk() can = Canvas(root, width=200, height=200) can.pack() shape1={'bounds': [20, 20, 80, 50], 'kind': 'rect', 'fill': True} shape2={'bounds': [80, 50, 20, 35],

How to update a graph created by matplotlib in tkinter

别等时光非礼了梦想. 提交于 2021-02-17 05:45:06
问题 I have an app created by using tkinter. There is just a window in which I'm typing X and Y. Having these x and y, my app should create a graph using matplotlib. First time it works correctly, but others no. I mean, I open the app, input X and Y, click button and the app creates graph, then I input new X and Y, click button and this doesn't work, graph is the same, not new. I've searched many sites, but no one of solutions works. a part of code looks like: from tkinter import * import

Python | How do i make a Fast Reaction test with Tkinter?

眉间皱痕 提交于 2021-02-17 05:34:10
问题 I tried making a fast reaction tester with Tkinter Module in Python, but when I clicked the Start button, it justs freezes the window. And I don't know how to recover that Here's my code: import webbrowser as wb import time import math from random import * from tkinter import * from PIL import ImageTk, Image seconds = 0 miliseconds = 0 minutes = 0 def reactionStarted(): global seconds, miliseconds, greenimages, redimages, minutes # Put Image Green reactionImage.config(image=greenimages) #

Python Tkinter Edit Menu Window

梦想的初衷 提交于 2021-02-17 05:30:25
问题 I'm trying to edit Menu window. How can i edit it? This is for Windows. from tkinter import * Window = Tk() MB = Menu(Window) Window.config(menu=MB) Menubar = Menu(MB) MB.add_cascade(label="File", menu=Menubar) Menubar.add_command(label="New File") #Btn1 = Button(Menubar, width=20, text="Button").pack() #I failed. Window.mainloop() I tried Btn1 = Button(Menubar, width=20, text="Button").pack() But this one couldn't work. 回答1: usually you add items to menu like this - but what are looking for?

How to solve file not found problem in python?

本秂侑毒 提交于 2021-02-17 05:21:45
问题 I had made a program where I require files from that directory where the python file is located. The files are located in the same folder where the python file located. I can't write the full path of the file in the python script I used the ./ method in the script but it gives error Please help me to solve the problem here is my code ''' #code root=Tk() root.title("SOHAM YOUTUBE VIDEO DOWNLOADER") root["bg"]='#1F1F1F' root.iconbitmap("./img/youtube_(1).ico") root.geometry("900x680") file

How to solve file not found problem in python?

荒凉一梦 提交于 2021-02-17 05:21:28
问题 I had made a program where I require files from that directory where the python file is located. The files are located in the same folder where the python file located. I can't write the full path of the file in the python script I used the ./ method in the script but it gives error Please help me to solve the problem here is my code ''' #code root=Tk() root.title("SOHAM YOUTUBE VIDEO DOWNLOADER") root["bg"]='#1F1F1F' root.iconbitmap("./img/youtube_(1).ico") root.geometry("900x680") file

Python- Changing from pack() to .grid() results in AttributeError: 'NoneType' object has no attribute 'get'

烂漫一生 提交于 2021-02-17 05:16:13
问题 While developing a tkinter interface for a small encryption program I switched it from .pack(), which I only used while beginning to write out the buttons e.g., to .grid(). Previously I had set up an Entry widget, two buttons and two functions linked to them. All they did was print whatever was in the Entry widget to the console. I changed the code to this: ##Please ignore the commented out stuff import time from tkinter import * def doNothing(): ##To when a menu item is clicked print(

Python- Changing from pack() to .grid() results in AttributeError: 'NoneType' object has no attribute 'get'

一个人想着一个人 提交于 2021-02-17 05:16:06
问题 While developing a tkinter interface for a small encryption program I switched it from .pack(), which I only used while beginning to write out the buttons e.g., to .grid(). Previously I had set up an Entry widget, two buttons and two functions linked to them. All they did was print whatever was in the Entry widget to the console. I changed the code to this: ##Please ignore the commented out stuff import time from tkinter import * def doNothing(): ##To when a menu item is clicked print(