tk

tkinter grid not working correctly

爷,独闯天下 提交于 2019-11-27 08:25:32
问题 when I try to make a window using tkinter in python 3.4.2, the windows opens, but the ..grid method doesnt function properly. The label and entry box dont move even though I change the row and column parameters. Please help: from tkinter import * root = Tk() root.geometry("1024x768") root.resizable(width=FALSE, height=FALSE) label_title = Label(root, text="Past paper helper") entry_1 = Entry(root) label_title.grid(row=0, column=5) entry_1.grid(row=16, column=1) root.mainloop() 回答1: Empty rows

How to disable manual resizing of Tkinter's Treeview column?

十年热恋 提交于 2019-11-27 06:19:08
问题 Since I can't horizontally scroll Treeview column due to what appears to be Tk/Tkinter limitation, I want to make it sticky so it is attached to the frame. The issue is that user can manually resize Treeview column which can mess up my interface in a certain way. Is it possible to disable such functionality? Note the size of the column header. User can drag mouse to resize column. I want to disable this. Setting minwidth to a certain value prevents column from shrinking, but it is still

Why import * and then ttk?

只谈情不闲聊 提交于 2019-11-27 03:29:16
问题 My understanding is that the standard set-up for a tkinter program starts off like this: from tkinter import * from tkinter import ttk I understand that tkinter is a package, but if I've already imported all with the * , why do I still need to import ttk ? Why do I get an error if I take out the second line and try to reference ttk ? 回答1: When you do from some_package import * , python will import whatever that package chooses to export. What it chooses to export may be a subset of what is

How to create equal-width columns in Python 2.7 with Tkinter

浪子不回头ぞ 提交于 2019-11-27 02:15:57
How can I force the columns in a Tkinter application window to be of equal width? The tkdocs website states as follows: The width of each column (or height of each row) depends on the width or height of the widgets contained within the column or row. This means when sketching out your user interface, and dividing it into rows and columns, you don't need to worry about each column or row being equal width [or height, presumably]. http://www.tkdocs.com/tutorial/grid.html But I want the columns to be equal width, preferably by making the width of all columns depend upon the widest widget in any

python tkinter界面 多进程启动scrapy爬取百度贴吧的回复,显示爬取进度,并可以搜索回帖人,指定时间生成词云图,用pyinstaller打包成exe(四)

ぃ、小莉子 提交于 2019-11-27 00:35:36
接着直接进入主题,scrapy的启动文件begin.py: ''' 本scrapy的运行顺序: 》初始的begin.py ,打开tk界面,输入各个参数,保存在config文件,点击运行 》先进入pipeleines.py,调用open_spider,获取config里的数据,设定spider各个参数 》回到spider.py,正式开始运行parse 》程序结束时,再调用pipeleines.py的close_spider,log此次爬取日志''' #设定log的输出设置 logging.basicConfig(level=logging.WARNING, format='asctime: %(asctime)s \n' # 时间 'bug_line: line:%(lineno)d \n' # 文件名_行号 'level: %(levelname)s \n' # log级别 'message: %(message)s \n', # log信息 datefmt='%a, %d %b %Y %H:%M:%S', filename='日志.log', # sys.path[1]获取当前的工作路径 filemode='a') # 如果模式为'a',则为续写(不会抹掉之前的log) #用以启动爬虫 from scrapy.crawler import CrawlerProcess from

Why are Tk GUI's considered ugly?

不打扰是莪最后的温柔 提交于 2019-11-27 00:28:11
问题 Tk GUI's seem to be universally considered ugly, but I'd like to know why specifically. Some in the Tcl/Tk world would argue that this is a moot point as there is much better support now for native look and feel, which is a big reason I decided on Tcl/Tk. Now, however, the problem is, because I'm leveraging a Tcl/Starkit vfs (virtual file system), the native file dialogs don't work, and I'm going to have to revert to pure Tk file dialogs. Please I'm looking for specific, technical reasons, e

Cannot launch git gui using cygwin on windows

大城市里の小女人 提交于 2019-11-26 23:53:30
问题 I used to launch git gui within my cygwin console without any problems but since I updated cygwin I've got the following error message: $ git gui Application initialization failed: no display name and no $DISPLAY environment variable Error in startup script: invalid command name "tk_messageBox" while executing "tk_messageBox -icon error -type ok -title "git-gui: fatal error" -message $err" invoked from within "if {[catch {package require Tcl 8.4} err] || [catch {package require Tk 8.4} err] }

Tkinter.PhotoImage doesn't not support png image

帅比萌擦擦* 提交于 2019-11-26 23:18:17
I am using Tkinter to write a GUI and want to display a png file in a Tkiner.Label . So I have some code like this: self.vcode.img = PhotoImage(data=open('test.png').read(), format='png') self.vcode.config(image=self.vcode.img) This code runs correctly on my Linux machine . But when I run it on my windows machine, it fails. I also tested on several other machines (include windows and linux), it failed all the time. The Traceback is: Exception in Tkinter callback Traceback (most recent call last): File "C:\Python27\lib\lib-tk\Tkinter.py", line 1486, in __call__ return self.func(*args) File "C:

Removing the TK icon on a Tkinter window

北慕城南 提交于 2019-11-26 22:24:23
Does anybody know how to make the icon not show up? I'm looking for a way to have no icon at all. Stobor On Windows Step One: Create a transparent icon using either an icon editor, or a site like rw-designer . Save it as transparent.ico . Step Two: from tkinter import * tk = Tk() tk.iconbitmap(default='transparent.ico') lab = Label(tk, text='Window with transparent icon.') lab.pack() tk.mainloop() On Unix Something similar, but using an xbm icon. ubomb Similar to the accepted answer (with the con of being uglier): import tkinter import tempfile ICON = (b'\x00\x00\x01\x00\x01\x00\x10\x10\x00

How to make a GUI for bash scripts? [closed]

纵然是瞬间 提交于 2019-11-26 18:50:46
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I want to make some graphical dialogs for my script but don't know how. I hear something about GTK-Server or something like that. If