tkinter

vertical padding between buttons in a column

牧云@^-^@ 提交于 2021-02-05 07:48:25
问题 When I pad the widgets they all just move together on the same frame in 1 big block. I need to be able to separate them and add the padding between each widget on the same frame. This is part of my code I tried: def CreateDisplay(self): self.mainwindow = tk.Tk() self.mainwindow.geometry("800x600") self.mainwindow.wm_title(self.constants.NAME) self.mainwindow.resizable(width=False, height=False) self.frame_main = tk.Frame(master = self.mainwindow) self.frame_title = tk.Frame(master = self

Is there way to return actual x,y-coordinates from the image?

醉酒当歌 提交于 2021-02-05 07:43:17
问题 my dear py-experts. I wrote a GUI program in python (Tkinter library) which displays a picture, to display an image i used the Canvas widget. The program does load a picture (its width/height always bigger than Canvas width/height) and when i make a mouse click on the Canvas it returns a x,y - coordinates (and color grayscale value), but it always a coordinates of Canvas, not an image ones. For example - image sizes are x=5040 and y=3360 and Canvas widget sizes are x=500 and y=400 and when i

How to wait for a mouse click?

放肆的年华 提交于 2021-02-05 07:11:48
问题 I want my code to start when I click left mouse button but my code starts right after I click on button. How to make my code wait for mouse input before continue? I already tried input() but it's not what I'm looking for. from tkinter import * import PIL.ImageGrab from PIL import ImageGrab import time import numpy as np import pyautogui import win32api def mouseposition(): global xclick global yclick xclick, yclick = win32api.GetCursorPos() print(xclick, yclick) def mouseclick(): state_left =

How to wait for a mouse click?

和自甴很熟 提交于 2021-02-05 07:11:00
问题 I want my code to start when I click left mouse button but my code starts right after I click on button. How to make my code wait for mouse input before continue? I already tried input() but it's not what I'm looking for. from tkinter import * import PIL.ImageGrab from PIL import ImageGrab import time import numpy as np import pyautogui import win32api def mouseposition(): global xclick global yclick xclick, yclick = win32api.GetCursorPos() print(xclick, yclick) def mouseclick(): state_left =

TkInter: drawing on wrong positions

余生颓废 提交于 2021-02-05 06:52:49
问题 I load a picture on the Canvas. It is a large picture so I need to scroll vertically and horizontally to be able to see it. I also let the user to drawn random curves/lines using the mouse pointer on the image. Everything is ok except that when I scroll horizontally or vertically then I try to draw I see the curves are not drawn where the mouse points to but in an other place. How can I resolve this problem ? Here is my code: import PIL.Image import PIL.ImageTk from Tkinter import * import

Tkinter: All radio buttons are already selected

被刻印的时光 ゝ 提交于 2021-02-05 06:05:38
问题 it is my first time using tkinter. I have an entry box on the first window, and I created radio buttons on different windows. The problem is that they are already selected before I click any of them. How can I change all buttons to be deselected? I am not sure if my codes are right or not. from tkinter import * from tkinter import messagebox class SortingHat: # Constructor def __init__(self): # Create main window self.__main_window = Tk() self.__main_window.geometry('300x200') self.__main

get Coordinates of matplotlib plot figure python with mouse click

£可爱£侵袭症+ 提交于 2021-02-05 05:49:26
问题 I have been trying to get the mouse x,y coordinates to variables according to matplotlib plot scale not pixels but it only returns me the integer components like 0.0 or 1.0 I want to return the accurate number like 0.1245 here is my code import matplotlib import Tkinter as tk from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg from matplotlib.figure import Figure import numpy as np import matplotlib.pyplot as plt def onclick(self,event): ix, iy = float

How to convert .exe file to windows setup wizard

痞子三分冷 提交于 2021-02-05 05:31:29
问题 I was creating an app through Tkinter. And after making I converted into .exe file using pyinstaller. It is good but I want to make it more professional. Like when we download any application from internet and open it it opens a setup wizard with license agreements and where to put all the files. I do not want to share my exe file but want to share my setup file. So, that when they click it will show license agreements, the path to save, and a few more like a real setup wizard. Please help me

Change width of dropdown listbox of a ttk combobox

家住魔仙堡 提交于 2021-02-05 04:45:39
问题 I am trying to change to width of the popdown list of the ttk Combobox. Setting the width of the Combobox also changes the width of the Listbox, making part of the values unreadable. I read this solution in Tk/Tcl but I am not familiar with this language and would like to solve the problem with Python. I tried changing the theme parameters but it does not seem to help. Below is a piece of sample code. import tkinter as tk from tkinter import ttk root = tk.Tk() root.title("testing the combobox

Change width of dropdown listbox of a ttk combobox

被刻印的时光 ゝ 提交于 2021-02-05 04:44:17
问题 I am trying to change to width of the popdown list of the ttk Combobox. Setting the width of the Combobox also changes the width of the Listbox, making part of the values unreadable. I read this solution in Tk/Tcl but I am not familiar with this language and would like to solve the problem with Python. I tried changing the theme parameters but it does not seem to help. Below is a piece of sample code. import tkinter as tk from tkinter import ttk root = tk.Tk() root.title("testing the combobox