tk

Why do treeview widget put an extra column although I only gave it two? I also can't control the width of it

若如初见. 提交于 2020-08-17 11:13:13
问题 I can't figure out how to control the width of the widget I can't make it display only 2 columns from Tkinter import * from ttk import Treeview root = Tk() tree = Treeview(root, height = 10, columns = 2) tree['columns'] = ('one','two') tree.column('one', width = 50) tree.column('two', width = 50) tree.heading('one', text = 'UserName', anchor = 'center') tree.heading('two', text = 'ID', anchor = 'centeenter code herer') tree.grid(row = 3, column = 0) root.mainloop() 回答1: That first column is

Why do treeview widget put an extra column although I only gave it two? I also can't control the width of it

↘锁芯ラ 提交于 2020-08-17 11:06:50
问题 I can't figure out how to control the width of the widget I can't make it display only 2 columns from Tkinter import * from ttk import Treeview root = Tk() tree = Treeview(root, height = 10, columns = 2) tree['columns'] = ('one','two') tree.column('one', width = 50) tree.column('two', width = 50) tree.heading('one', text = 'UserName', anchor = 'center') tree.heading('two', text = 'ID', anchor = 'centeenter code herer') tree.grid(row = 3, column = 0) root.mainloop() 回答1: That first column is

Install TCL/TK without root

别来无恙 提交于 2020-07-09 08:44:38
问题 I'm trying to install TCL/TK as a regular user on RedHat 5: TCL_VERSION=8.6.1 BASE_PATH=/myownpath tar -xzf tcl${TCL_VERSION}-src.tar.gz cd tcl${TCL_VERSION}/unix ./configure \ --prefix=${BASE_PATH} \ --without-tzdata \ --enable-64bit make -j9 sed -e "s@^\(TCL_SRC_DIR='\).*@\1${BASE_PATH}'@" \ -e "/TCL_B/s@='\(-L\)\?.*unix@='\1${BASE_PATH}/lib@" \ -i tclConfig.sh make install make install-private-headers chmod -v 755 ${BASE_PATH}/lib/libtcl*.so So far so good: ${BASE_PATH}/include/tcl.h

Install TCL/TK without root

a 夏天 提交于 2020-07-09 08:44:20
问题 I'm trying to install TCL/TK as a regular user on RedHat 5: TCL_VERSION=8.6.1 BASE_PATH=/myownpath tar -xzf tcl${TCL_VERSION}-src.tar.gz cd tcl${TCL_VERSION}/unix ./configure \ --prefix=${BASE_PATH} \ --without-tzdata \ --enable-64bit make -j9 sed -e "s@^\(TCL_SRC_DIR='\).*@\1${BASE_PATH}'@" \ -e "/TCL_B/s@='\(-L\)\?.*unix@='\1${BASE_PATH}/lib@" \ -i tclConfig.sh make install make install-private-headers chmod -v 755 ${BASE_PATH}/lib/libtcl*.so So far so good: ${BASE_PATH}/include/tcl.h

Issues with tk in ipython/jupyter

天涯浪子 提交于 2020-05-16 13:51:14
问题 I am trying to write a gui for launching from an ipython/jupyter notebook but am running into trouble using tkinter from the notebook, especially in getting the tk gui window to close gracefully. What are best practices for how to make/launch a tkinter gui from jupyter and then close it without killing the ipython kernel? This is my first time trying to use tkinter. I found a lot of detailed info about how to do this with older ipython versions (e.g., iPython 3.2), but not as much for more

JS操控CSS样式完成小球自由落体运动,和大家分享一下制作心得。

|▌冷眼眸甩不掉的悲伤 提交于 2020-04-17 02:20:38
【推荐阅读】微服务还能火多久?>>> 这篇心得本应该在一个月之前和大家一起分享的,由于本人比较懒,也几乎没有写博客的习惯,所以迟了一些。有一些内容只是一些个人的废话,可看可不看,毕竟在国内的应试教育下,大家基础物理知识都是很扎实的: (废话) (背景:下面讨论的物体运动默认为宏观角度)一般情况下,物体在三维空间所发生的位移都可以解析为若干连续的在二维空间所发生的位移的和,同理,物体在二维空间所发生的位移也可以解析为若干连续的在一维空间所发生位移的和。基于这个思想(本人的个人体会,对错有待验证),往往一个物体复杂的运动,若将其位移解析为不同一维空间所发生位移的总和,则会让我们能更好地去理解和模拟物体的运动规律。 (废话) 关于自由落体,若在外部环境稳定的情况下,我们可以视其为一个有规律的运动(所谓有规律的运动,运动的方式或过程具有周期性,可重复性),这样我们在写代码的时候,只要抓住其第一个周期的运动规律和初始状态,整个运功过程就可以被复制下来。 (废话) 在中学时期,我们都学过自由落体,老师教我们将它的运动过程解析为水平方向(X轴)和竖直方向(Y轴)的运动轨迹之和,本人能力有限,对物体的运动规律理解不够深刻,所以不能跳出教科书所给定的常规方法,故也采用此法,若不能带给大家更多新的东西,望见谅。 (废话) 如何理解位移:简单地说,就是物体在下一时刻所处的位置交上一时刻所处的位置的“差”

How to catch the maximize signal in Tk?

大城市里の小女人 提交于 2020-03-22 07:54:13
问题 You can bind a command with the X button of the window by this: wm protocol $windowPath WM_DELETE_WINDOW $command How can I do the same for the maximize button of the window? 回答1: There's no standard protocol for it, either among the X11 ICCCM set or the FreeDesktop set. As such, wm protocol cannot possibly be used for it. However, you can use the <Configure> event to track all size changes for a window. Note that if you set it on a toplevel, you will also get notifications for all widgets

【Paper】ELMo:ELMO wants to play!

半城伤御伤魂 提交于 2020-03-07 03:01:02
今天学习的是 AllenNLP 和华盛顿大学 2018 年的论文《Deep contextualized word representations》,是 NAACL 2018 best paper。 这篇论文提出的 ELMo 模型是 2013 年以来 Embedding 领域非常精彩的转折点,并在 2018 年及以后的很长一段时间里掀起了迁移学习在 NLP 领域的风潮。 ELMo 是一种基于语境的深度词表示模型(Word Representation Model),它可以捕获单词的复杂特征(词性句法),也可以解决同一个单词在不同语境下的不同表示(语义)。 ELMo 本身思想不难,但是很多细节在论文中都没有给出,而是给出其他论文的引用,大大增加了阅读难度。翻阅了很多博客但是写得好的没几篇,大部分博客都只是介绍了 ELMo 的多层双向 LSTM 结构,而忽视其预训练方式和使用方式。 本文在书写过程中尽量涵盖一些我认为很重要的一些细节,也希望抛砖引玉得到大佬们更详细的见解。 1. Introduction 以 Word2Vec 和 GloVe 为代表的词表示模型通过训练为每个单词训练出固定大小的词向量,这在以往的 NLP 任务中都取得了不错的效果,但是他们都存在两个问题: 没法处理复杂的单词用法,即语法问题; 没办法结合语境给出正确词向量,即一词多义; 为了解决这个问题