tkinter

Tkinter is opening multiple GUI windows upon file selection with multiprocessing, when only one window should exist

回眸只為那壹抹淺笑 提交于 2021-02-10 08:08:27
问题 I have primary.py: from tkinter import * from tkinter.filedialog import askopenfilename from tkinter import ttk import multiprocessing as mp import other_script class GUI: def __init__(self, master): self.master = master def file_select(): path = askopenfilename() if __name__ == '__main__': queue = mp.Queue() queue.put(path) import_ds_proc = mp.Process(target=other_script.dummy, args=(queue,)) import_ds_proc.daemon = True import_ds_proc.start() # GUI root = Tk() my_gui = GUI(root) # Display

Tkinter is opening multiple GUI windows upon file selection with multiprocessing, when only one window should exist

与世无争的帅哥 提交于 2021-02-10 08:06:21
问题 I have primary.py: from tkinter import * from tkinter.filedialog import askopenfilename from tkinter import ttk import multiprocessing as mp import other_script class GUI: def __init__(self, master): self.master = master def file_select(): path = askopenfilename() if __name__ == '__main__': queue = mp.Queue() queue.put(path) import_ds_proc = mp.Process(target=other_script.dummy, args=(queue,)) import_ds_proc.daemon = True import_ds_proc.start() # GUI root = Tk() my_gui = GUI(root) # Display

Understanding what files in the TCL are required for distributing frozen Python Tkinter apps

徘徊边缘 提交于 2021-02-10 07:52:46
问题 I'm trying to figure out which files in Python's (Python 2.6/Python 2.7) tcl folder are required in order to distribute frozen Python Tkinter apps using Py2exe or similar. The quick and dirty way to do this (using pyexe as an example) is to follow the 2nd example on the following page and then xcopy your python's tcl folder to your dist folder (as a tcl sub-folder). http://www.py2exe.org/index.cgi/TixSetup The problem with the xcopy tcl technique is that it copies 100's of extra files that

Writing a Python UI for a seperate program with tkinter. The stop button for this program basically freezes the UI and continues with the script

落爺英雄遲暮 提交于 2021-02-10 06:25:29
问题 Here is what I coded... import tkinter as tk import subprocess import sys import time import os import tkinter.font as font from tkinter.ttk import * app = tk.Tk() app.geometry("400x400") app.configure(bg='gray') photo = tk.PhotoImage(file=r"C:\Users\ex\ex_button_active.png") myFont = font.Font(family='Helvetica', size=20, weight='normal') tk.Label(app, text='EX', bg='gray', font=( 'Verdana', 15)).pack(side=tk.TOP, pady=10) app.iconbitmap(r'C:\Users\ex\ex_icon.ico') start = time.time() cmd =

Writing a Python UI for a seperate program with tkinter. The stop button for this program basically freezes the UI and continues with the script

别说谁变了你拦得住时间么 提交于 2021-02-10 06:25:16
问题 Here is what I coded... import tkinter as tk import subprocess import sys import time import os import tkinter.font as font from tkinter.ttk import * app = tk.Tk() app.geometry("400x400") app.configure(bg='gray') photo = tk.PhotoImage(file=r"C:\Users\ex\ex_button_active.png") myFont = font.Font(family='Helvetica', size=20, weight='normal') tk.Label(app, text='EX', bg='gray', font=( 'Verdana', 15)).pack(side=tk.TOP, pady=10) app.iconbitmap(r'C:\Users\ex\ex_icon.ico') start = time.time() cmd =

How to retrieve a single value from a TinyDB database?

丶灬走出姿态 提交于 2021-02-10 03:02:50
问题 I'm learning how to use TinyDB on Python and I have the basics working (add, remove, update etc.). But now I'm trying to retrieve specific values from the database. The code I'm using is in this method: def showpassword(): show = userdb.get(where("username") == txtname.get()) txtshow.insert(0, show) When I run the method, it displays the output as follows: {'username': 'John', 'surname': 'Doe'} How can I get it so that I can display only the user's name or surname and without any brackets?

Displaying Pandas dataframe in tkinter

自古美人都是妖i 提交于 2021-02-09 11:50:33
问题 I'm creating a tkinter gui that will take user input for a variable that then gets passed to SQL and the queried data (in this case a single column data frame and boxplot). However, at this moment I can not find a means of displaying my pandas dataframe in the tk gui. I have not found any module or means of displaying this, and I've spent hours going through possible solutions to no avail. Only thing I need is for the dataframe to display in the gui and be re-rendered each time I change the

你用 Python 写过最牛逼的程序是什么?

那年仲夏 提交于 2021-02-09 11:31:32
编译:Python开发者 - Jake_on 英文:Quora http://python.jobbole.com/85986/ 有网友在 Quora 上提问,「你用 Python 写过最牛逼的程序/脚本是什么?」。本文摘编了 3 个国外程序员的多个小项目,含代码。 Manoj Memana Jayakumar, 3000+ 顶 更新:凭借这些脚本,我找到了工作!可看我在这个帖子中的回复,《Has anyone got a job through Quora? Or somehow made lots of money through Quora?》 1. 电影/电视剧 字幕一键下载器 我们经常会遇到这样的情景,就是打开字幕网站subscene 或者opensubtitles, 搜索电影或电视剧的名字,然后选择正确的抓取器,下载字幕文件,解压,剪切并粘贴到电影所在的文件夹,并且需把字幕文件重命名以匹配电影文件的名字。是不是觉得太无趣呢?对了,我之前写了一个脚本,用来下载正确的电影或电视剧字幕文件,并且存储到与电影文件所在位置。所有的操作步骤仅需一键就可以完成。懵逼了吗? 请看这个 Youtube 视频:https://youtu.be/Q5YWEqgw9X8 源代码 存放在GitHub: subtitle-downloader 更新: 目前,该脚本支持多个字幕文件同时下载。步骤

Drawing a png image on a tkinter canvas python

与世无争的帅哥 提交于 2021-02-09 10:58:30
问题 I am trying to create a simple game using tkinter in python 3.5 using the canvas widget. For this game I am need to be able to use a transparent (png) image. Here is my code: from PIL import ImageTk from tkinter import Tk, Canvas root = Tk() im = ImageTk.PhotoImage(file="test.png") canvas = Canvas(root, width=900, height=900) canvas.pack() canvasImage = canvas.create_image(0, 0, image=im, anchor="nw") root.mainloop() The problem is that, despite getting no errors i can't load an image with a

Drawing a png image on a tkinter canvas python

白昼怎懂夜的黑 提交于 2021-02-09 10:58:13
问题 I am trying to create a simple game using tkinter in python 3.5 using the canvas widget. For this game I am need to be able to use a transparent (png) image. Here is my code: from PIL import ImageTk from tkinter import Tk, Canvas root = Tk() im = ImageTk.PhotoImage(file="test.png") canvas = Canvas(root, width=900, height=900) canvas.pack() canvasImage = canvas.create_image(0, 0, image=im, anchor="nw") root.mainloop() The problem is that, despite getting no errors i can't load an image with a