tk

tkinter grid not working correctly

倖福魔咒の 提交于 2019-11-28 14:29:11
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() Empty rows and columns have zero size. Column 1000 will give the same effect as column 0, if columns 0-999 are empty.

Add tkinter's intvar to an integer

房东的猫 提交于 2019-11-28 14:20:32
I'm having some trouble adding a value taken from an Entry box and adding it to an existing number. In this case, I want the value of the "change speed" box to be added to the robots current speed. When run, my code produces an error: TypeError: unsupported operand type(s) for +=: 'int' and 'IntVar'. Below is the code that produces the entry box: change_speed_entry = ttk.Entry(main_frame, width=5) # Entry box for linear speed change_speed_entry.grid() data = tkinter.IntVar() change_speed_entry['textvariable'] = data And next is where I try to manipulate the result. This is a method within a

How to use default bindtag behavior as methods?

不想你离开。 提交于 2019-11-28 14:04:56
问题 I am trying to invoke default widget behavior on demand. Based on this answer I know a bit about bindtags, and taglists. Let's say for example I have two buttons, and I want to have the bindtag behavior of a specific item in its taglist, of first button, whenever I left click on the right button: import tkinter as tk root = tk.Tk() first_btn = tk.Button(root, text="1st") second_btn = tk.Button(root, text="2nd") second_btn.bind("<Button-1>", "expect the bindtag operation here") first_btn.pack(

How to get text from Entry widget

早过忘川 提交于 2019-11-28 12:57:05
问题 I've looked at several posts on stackOverflow that explain the answer but no matter which I use, I never can get the string from my entry widget; it just detects a string of "" here's my code: def buttonTest(): global score gui.title("Test") for child in gui.winfo_children(): child.destroy() global questionText global questionAnswer questionText = StringVar() questionAnswer = 0 question = Label(gui, textvariable = questionText, fg = "black", bg = "white") question.grid(row = 0, column = 1)

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

痴心易碎 提交于 2019-11-28 11:37:04
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 possible to resize it to a larger width. I suppose I can react to changing width and just revert it to

python获取页面文字信息

偶尔善良 提交于 2019-11-28 06:06:55
# -*- coding: utf-8 -*- from selenium import webdriver import time, re,requests,os,time,random,traceback import urllib.request,threading from bs4 import BeautifulSoup import html.parser from tkinter import * from tkinter import ttk import tkinter.messagebox def getHtml(questionId,page): chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--start-maximized') # 最大化运行(全屏窗口),不设置,取元素会报错 chrome_options.add_argument('--disable-infobars') # 禁用浏览器正在被自动化程序控制的提示 chrome_options.add_argument('--incognito') # 隐身模式(无痕模式) chrome_options.add_argument('--headless') # 浏览器不提供可视化页面 driver =

报表开发思路之报表规则认定以及层次坐标

旧街凉风 提交于 2019-11-28 05:22:56
第一节:扩展规则 单元格进行扩展时,主单元格或同级别单元格被拉大成合并单元格,附属单元格被动复制;上主格扩展时(横向扩展),附属格被横向同步复制;左主格扩展时(纵向扩展),附属单元格纵向被同步复制。 扩展类型包含:横向扩展、纵向扩展、不可扩展 三种类型; 延伸扩展概念:跟随扩展、多层扩展、交叉扩展 跟随扩展 :当一个单元格扩展时,它可以带动其他单元格跟随它一同扩展。 多层扩展 :一个单元格可能既跟随其他单元格扩展(做为其他单元格的附属格),同时也自身扩展(做为另外单元格的主格)。 交叉扩展 :同一报表中可能同时有纵向扩展格和横向扩展格,如果它们的子格有重叠部分,则这些子格就既有左主格又有上主格,在扩展时会被既向下又向右复制,形成一片矩形单元格区域,从而做到交叉扩展。 例如下图所示: 第二节:引用规则 单元格扩展时,附属单元格可以动态引用主单元格的值。随着主单元格扩展,附属单元格被复制到不同的新的位置,对主单元格的引用也相应的发生变化。 例如:=A2*3 (其中 A2为扩展主格) 第三节:统计规则 单元格扩展时,附属单元格如采用缺省的集合表达式,则缺省统计所属主格区域范围内的所有的目标单元格的值 例如:SUM(C4{}) 第四节:主附规则 1 、 左主格认定 即跟随着执行纵向扩展;左主格的认定是从当前单元格依次向左反推查找。假设当前单元格为C2,左边单元格为B2 ①

Why are Tk GUI's considered ugly?

天大地大妈咪最大 提交于 2019-11-28 04:31:40
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.g. regarding font aliasing (or lack thereof) or font style, or color, etcetera. Because I personally

Cannot launch git gui using cygwin on windows

心已入冬 提交于 2019-11-28 02:43:16
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] } { catch {wm withdraw .} tk_messageBox \ -icon error \ -typ..." (file "/usr/lib/git-core/git-gui" line

multiple comboboxes in R using tcltk

不问归期 提交于 2019-11-28 01:37:46
问题 I have been trying to define multiple combo boxes in R using the tcltk package but to no avail. I am using the below code. My inspiration was here, however I can't seem to just label them comboBox1, comboBox2, etc... so I decided to try and set their output values into a vector... but their output values don't make any sense to me... any ideas out there? many thanks require(tcltk) tclRequire("BWidget") tt <- tktoplevel() tkgrid(tklabel(tt,text="What's your favorite fruits?")) fruit <- c(