tkinter

how to print previous 30 days from a date in python and the same in Tkinter

♀尐吖头ヾ 提交于 2021-02-05 12:22:26
问题 I am using Tkinter to build a Corona Travel History Questionnaire. The front end has options to select a particular date - " D-Day Cronoa Confirmed". Once the D-day is confirmed, the program is supposed to give fields for entering data on travel history. I am using tkcalendar module in Python. Problem: How to print the previous 30 days from a given date in python? Question: Can we do anything in tkcalendar to print the last 30 days from a selected date in the window itself? 回答1: Using the

tkinter frame propagate not behaving?

时间秒杀一切 提交于 2021-02-05 12:18:42
问题 If you uncomment the options_frame_title you will see that it does not behave properly. Am I missing something? That section was just copied and pasted from the preview_frame_title and that seems to have no issues. from tkinter import * blank_app = Tk() blank_app.geometry('750x500+250+100') blank_app.resizable(width=False, height=False) main_frame = Frame(blank_app, width=750, height=500, bg='gray22') main_frame.grid(row=0, column=0, sticky=NSEW) main_title = Label(main_frame, text='App

How do I get the value of an entry and enter it in Ssol.txt? [duplicate]

让人想犯罪 __ 提交于 2021-02-05 12:17:34
问题 This question already has answers here : Get contents of a Tkinter Entry widget (3 answers) Closed 3 years ago . from tkinter import * from tkinter import ttk win = Tk() win.title("hello") win.geometry('510x50+200+100') Block = IntVar() def x(): k = open("Ssol.txt", 'w') Entry(win, width=5, textvariable=Block).grid(column=1, row=0,sticky=(N,W,E)) ttk.Button(win, text="실행", command=x).grid(column=0, row=1,sticky=(W,E)) mainloop() I want to get the value of entry and input it in Ssol.txt. def x

Gather input from multiple tkinter checkboxes created by a for loop

纵然是瞬间 提交于 2021-02-05 12:16:43
问题 I made an application with tkinter which creates a list of checkboxes for some data. The checkboxes are created dynamically depending on the size of the dataset. I want to know of a way to get the input of each specific checkbox. Here is my code, which you should be able to run. from tkinter import * root = Tk() height = 21 width = 5 for i in range(1, height): placeholder_check_gen = Checkbutton(root) placeholder_check_gen.grid(row=i, column=3, sticky="nsew", pady=1, padx=1) for i in range(1,

tkinter frame propagate not behaving?

女生的网名这么多〃 提交于 2021-02-05 12:16:36
问题 If you uncomment the options_frame_title you will see that it does not behave properly. Am I missing something? That section was just copied and pasted from the preview_frame_title and that seems to have no issues. from tkinter import * blank_app = Tk() blank_app.geometry('750x500+250+100') blank_app.resizable(width=False, height=False) main_frame = Frame(blank_app, width=750, height=500, bg='gray22') main_frame.grid(row=0, column=0, sticky=NSEW) main_title = Label(main_frame, text='App

How to add hover feature for text description on a Tkinter button?

非 Y 不嫁゛ 提交于 2021-02-05 11:52:37
问题 I want to add a hover feature on a Tkinter button where if the user hovers the mouse cursor then description text displays. I also want to add some delay for that description to appear so that it would not be intrusive. I can try using the "<Enter>" and "<Leave>" binding of the button to a function and make some "Label" appear in some corner of the app. But this approach may not be the most elegant. 回答1: Here is a small snippet using Pmw (python mega widgets) for the tool tips. Firstly start

How to add hover feature for text description on a Tkinter button?

天大地大妈咪最大 提交于 2021-02-05 11:52:10
问题 I want to add a hover feature on a Tkinter button where if the user hovers the mouse cursor then description text displays. I also want to add some delay for that description to appear so that it would not be intrusive. I can try using the "<Enter>" and "<Leave>" binding of the button to a function and make some "Label" appear in some corner of the app. But this approach may not be the most elegant. 回答1: Here is a small snippet using Pmw (python mega widgets) for the tool tips. Firstly start

How to change foreground color of a ttk button that is disabled?

限于喜欢 提交于 2021-02-05 11:27:05
问题 When I disable a button the color change automatically to black. This is the code : from tkinter import * from tkinter import ttk root=Tk() style=ttk.Style() style.configure('TButton', foreground='red') bu1=ttk.Button(root, text="Hello world") bu1.grid(row=0, column=0) bu2=ttk.Button(root, text="Hello world2") bu2.grid(row=1, column=0) bu1.state(['disabled']) bu2.state(['disabled']) root.mainloop() Any help? 回答1: Since you are using a ttk button, you can map certain attributes to different

Redirecting stdout to tkinter immediately (without waiting for the process to complete)

别说谁变了你拦得住时间么 提交于 2021-02-05 11:26:30
问题 I am writing a python app to take some inputs from the user and call a shell script based on these inputs. This shell script can run for quite sometime, and I want to redirect the output it produces (in realtime) to tkinter. I managed to do that, but it only happens after the shell script is completely finished, not as soon as the shell script "echos" something for example. So main problem: 1. Output appears in the text widget only after shellScript.sh is exited (although if I run the same in

getting selected value of Combobox python

血红的双手。 提交于 2021-02-05 11:15:36
问题 Hi I have the following code def create(self): geo = StringVar() city = ttk.Combobox(gui, textvariable=geo,state="readonly") city.config(values=self.geo) city.pack() city.bind("<<ComboboxSelected>>", self.cityselection) def cityselection(self,event): selected=event print(selected) I want to send the selected value of from the Combobox to cityselection function but when I print it I only get VirtualEvent event x=0 y=0 and it does not matter which value I choose I will always get the above