tk

What to use instead of NavigationToolbar2TkAgg?

牧云@^-^@ 提交于 2019-12-01 17:08:16
When I run the following script: import tkinter as tk import matplotlib import matplotlib.pyplot as plt import matplotlib.figure import matplotlib.backends.backend_tkagg import numpy as np def on_key_event(event, canvas, toolbar): matplotlib.backend_bases.key_press_handler(event, canvas, toolbar) matplotlib.use('TkAgg') root = tk.Tk() root.wm_title('Test window') fig = matplotlib.figure.Figure(figsize=(9.333, 7), dpi=100) a = fig.add_subplot(111) axes = fig.gca() x = np.linspace(0, 2*np.pi, 100) axes.plot(x, np.sin(x), marker='.') axes.set_title('sin(x)') axes.grid() canvas = matplotlib

Python/Tkinter: expanding fontsize dynamically to fill frame

强颜欢笑 提交于 2019-12-01 13:08:46
I know you can get frame widgets to expand and fill all of the area available to them in their container via these commands: frameName.pack(fill = 'both', expand = True) What would do the same for a text's font size? Currently my text is an attribute of a label widget. The label widget's parent is frameName . I guess I could define my own function to call labelName.config(fontsize = N) to update the font size as the frame get's bigger, but I'm not sure how to correlate them. This is what my program looks like right now: Each of those blocks is a frame widget. I'd like the text to expand to

mybatis/tk mybatis下实体字段是关键字/保留字,执行报错

Deadly 提交于 2019-12-01 12:37:05
实体如下: import com.fasterxml.jackson.annotation.JsonFormat; import com.netmarch.web.bean.PagesStatic; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.format.annotation.DateTimeFormat; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.Transient; import java.time.LocalDateTime; @Data @NoArgsConstructor @AllArgsConstructor @Builder /*** * app图标 */ @JsonFormat public class ApiCertificate{ @Id @GeneratedValue(generator = "JDBC")

TKinter leaving borders around widgets

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-01 12:30:33
When I put a button in on a colored background TKinter leaves this weird white box around the widget. For example the code below: from Tkinter import * root = Tk() root.geometry("300x100+300+300") root.configure(bg="red") button = Button(root, text="Connect", highlightthickness=0) button.pack() root.mainloop() What can I do to get rid of the white spacing? The extra border is caused by the highlightthickness attribute. The default value is 1 (one); set it to zero to remove the border. This border shows when the button has keyboard focus. However, it appears you're running this on OSX. OSX

Mac OS X: Can I write application files within the app bundle?

与世无争的帅哥 提交于 2019-12-01 12:19:37
The application will be located in /Applications. The application will be downloaded via a web browser and not via the App Store. The language being used is Tcl/Tk. A. Will this work on all versions of OS X 10.5 or higher? B. Is there a better place to store application files? ~/Library/Application support is a way better place to store your files: Use this directory to store all app data files except those associated with the user’s documents. For example, you might use this directory to store app-created data files, configuration files, templates, or other fixed or modifiable resources that

Mac OS X: Can I write application files within the app bundle?

ぃ、小莉子 提交于 2019-12-01 11:37:05
问题 The application will be located in /Applications. The application will be downloaded via a web browser and not via the App Store. The language being used is Tcl/Tk. A. Will this work on all versions of OS X 10.5 or higher? B. Is there a better place to store application files? 回答1: ~/Library/Application support is a way better place to store your files: Use this directory to store all app data files except those associated with the user’s documents. For example, you might use this directory

TKinter leaving borders around widgets

妖精的绣舞 提交于 2019-12-01 09:50:25
问题 When I put a button in on a colored background TKinter leaves this weird white box around the widget. For example the code below: from Tkinter import * root = Tk() root.geometry("300x100+300+300") root.configure(bg="red") button = Button(root, text="Connect", highlightthickness=0) button.pack() root.mainloop() What can I do to get rid of the white spacing? 回答1: The extra border is caused by the highlightthickness attribute. The default value is 1 (one); set it to zero to remove the border.

Ruby + Tk command binding - scope issue?

耗尽温柔 提交于 2019-12-01 06:19:43
So I have this app require 'tk' class Foo def my_fancy_function puts "hello, world!" end def initialize @root = TkRoot.new{title "Hello, world!"} frame = TkFrame.new my_fancy_button = TkButton.new(frame) do text "Press meee" command {my_fancy_function} pack end frame.pack Tk.mainloop end end bar = Foo.new But if I press the button, I get "NameError: undefined local variable or method `my_fancy_function' for #<TkButton:..." I'm pretty sure I'm missing something trivial related to scope... how do I bind that command to the button correctly? Edit: Okay, if I change my my_fancy_button block to

Ruby + Tk command binding - scope issue?

我怕爱的太早我们不能终老 提交于 2019-12-01 06:09:40
问题 So I have this app require 'tk' class Foo def my_fancy_function puts "hello, world!" end def initialize @root = TkRoot.new{title "Hello, world!"} frame = TkFrame.new my_fancy_button = TkButton.new(frame) do text "Press meee" command {my_fancy_function} pack end frame.pack Tk.mainloop end end bar = Foo.new But if I press the button, I get "NameError: undefined local variable or method `my_fancy_function' for #<TkButton:..." I'm pretty sure I'm missing something trivial related to scope... how

Add a popup text box within an R script using tcltk

北战南征 提交于 2019-12-01 03:14:47
问题 I have a long-ish script to do some data analysis, and it has to connect to several databases. One of the databases tends to update my password more frequently than I like, so I'd like to add a popup box for me to enter my current password. I found this example but don't understand enough tcltk to see hwo to return my value when the dialog box is dismissed. I've thought of defining it as a global variable ( <<- ) within the OnOK function, but this seems messy require(tcltk) tt<-tktoplevel()