tkcalendar | Calendar widget for Tkinter
kandi X-RAY | tkcalendar Summary
kandi X-RAY | tkcalendar Summary
Calendar widget for Tkinter
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Setup the style
- Configure configuration parameters
- Triggers the event
- Display the list of days with other months
- Display the current calendar
- Set state of combobox
- Example example
- Display the date range
- View the date
- Get selection date
- Display the tooltip
- Get the value of a key
- Called when the theme changes
- Setup style
tkcalendar Key Features
tkcalendar Examples and Code Snippets
Community Discussions
Trending Discussions on tkcalendar
QUESTION
I am currently trying to write a code that is supposed to add mulitple dataframes into one, using the append method. However, with the code I currently use, it seems that only the first dataframe is read. I have tried locating the problem by adding a len(df) to my code and it seems to that the merged dataframe lenght does not change after appending a new one. I am also using a loop that reads threw the files in a folder and this is used in order to only use the top rows for the first dataframe and then skip them when it is not the first.
In my loop I get the output:
41568
READING FILE 2
lenght of added dataframe 1044
lenght of appended dataframe: 41568
READING FILE 3
lenght of added dataframe 9138
lenght of appended dataframe: 41568
I expected to get the results of a combined dataframe.
The expected output is:
41568
READING FILE 2
lenght of added dataframe 1044
lenght of appended dataframe: 42612
READING FILE 3
lenght of added dataframe 9138
lenght of appended dataframe: 51750
My current code is:
...ANSWER
Answered 2022-Apr-04 at 09:36After appending the dataframe you need to asssign it to variable like below
merged_df = merged_df.append(testcsv)
QUESTION
I am creating a GUI using tkinter in python and I have managed to print the date of what the user had selected using dateEntry but I am wondering if it is possible to only extract the year of the user?
Here is what my code looks like:
...ANSWER
Answered 2022-Apr-03 at 13:00The DateEntry object can return a date object, using .get_date()
instead of .get()
. Using .get
returns a string.
QUESTION
My problem is I want to get the value of the date that was selected in the ttk.DateEntry widget. According to this documentation you need to use get_date() Docs
It may be that I am misunderstanding the usage of that but I get the following error
AttributeError: 'DateEntry' object has no attribute 'get_date'
I do use this library for styling ttkboostrap
Here is my code example:
...ANSWER
Answered 2022-Apr-01 at 07:30The document link is about tkcalendar.DateEntry
, however your code uses DateEntry
from ttkbootstrap
module instead of tkcalendar
module.
To get the date from ttkbootstrap.DateEntry
, you need to get the content from the internal Entry
widget using .get()
:
QUESTION
I have a program that creates a form so you can use it to add entries into a SQL Server database.
One of the things I wanted to add was a calendar widget so the user can choose the time by clicking on that date in the tkcalendar widget rather than writing it. I created the widget, but I have no idea how to get the date from the widget and then enter it into SQL Server.
Can someone please help?
...ANSWER
Answered 2022-Mar-09 at 07:04The answer was to replace Kuupäev_entry.get() with cal.get_date()
QUESTION
I have a main window with an element, key = -PATIENT-. When I exit the element a function runs to capitalise the entry and to update the element. All good. I also have a secondary window with an element,key = -NAME-. I want to be able to bind the secondary window element so that when I exit it, it will also run a similar function to capitalise the entry and update the element. This is where I have a problem. When a name is entered in the -PATIENT- element, on FocusOut the name is capitalised and checked against a list of names. If the names is not in the list a popup asks if it should be put into the secondary window element. If affirmative this is done. However, if from the dropdown menu (Edit) a new name should be added to the -NAME- element of the secondary window, then if the name is in lower case, the function to change its first letters to uppercase should run. I cannot get this binding to work for the secondary window. I am attaching a simple sample program (code) to illustrate the problem. Please help.
...ANSWER
Answered 2022-Mar-02 at 13:30Didn't I already reply this issue about three days ago ?
Three issues found here
- Find element by
window[key]
for call functionwindow.find_element(key)
, notwindow.find_element[key]
- Don't use the same name for a function and a variable, like
QUESTION
Just picked up tkinter recently
I have a program where when a user click a [...] button, it will display a toplevel window containing a calendar and [OK] button inside it.
When the user click the [OK] button, I want it to change [startDate] variable, and [labelStartDate] label in the main window. I need the [startDate] variable for my next data process. and [labelStartDate] label is to show user that the date is changed.
How to achieve that? I tried to use command=lambda or stringvar, but honestly I am kinda lost trying to apply it to my program.
...ANSWER
Answered 2022-Feb-28 at 04:38You can first use tkinter.StringVar() and set the label textvariable to the same, inorder to be able to modify the label's text.
QUESTION
I have written a program using Tkinter and then, the same program using PySimpleGUI. When I run a report in the Tk program in outputs the data to the console and also opens an editor and lists the formatted data so that it can be printed. The PySimpleGUI program also outputs the data to the console and opens the editor but does not populate it. Can anyone see what the 'problem/solution' may be? I have only shown the code related to the report writer for brevity. I suspect that the problem lies in the last approximately 6 lines.
Secondly, if I use a popup_get_date()
it produces a date in the wrong format (I want 'yyyy-MM-dd'
. Is there a way to tell the popup to produce the date in the correct format? For example I want the following to happen: window['ELEMENT].update(sg.popup_get_date()
) to put a formatted date into the Element.
ANSWER
Answered 2022-Feb-13 at 12:30Why not print directly?
In one of my programs that has to work both on POSIX systems and ms-windows, I have the following:
QUESTION
I have a cashbook program that makes use of TABS to separate receipt entries from expense entries. In both the 'Receipts' and 'Expenses' tabs there is an Input element for entering a money value. I want to bind the element so that when losing focus it converts the figure entered to a format with 2 decimal places. (see:event=='-RECAMNT-FOCUS OUT':). The problem is that when I run the code an error comes up stating that you cannot perform operations on an element until read() is called or finalize=True when window is created. The binding works perfectly in a program with just a main window (without tabs). Can anyone please tell me how to solve this problem? I am unable to add 'finalize=True' where the window creation has 3 layouts. window =sg.Window('Cash Book',layout).Layout(tabgrp).layout(layout3)
I am posting extracted code to show where the problem appears to arise.
...ANSWER
Answered 2022-Feb-10 at 14:19Many of the Window methods require you to either call Window.read or Window.Finalize (or set finalize=True in your Window call) before you call the method. This is because these 2 calls are what actually creates the window using the underlying GUI Framework. Prior to one of those calls, the methods are likely to crash as they will not yet have their underlying widgets created.
My suggestion
QUESTION
I have a short PySimpleGUI program to test FocusOut. Jason Yang provided the code which works exactly as I want it to. However, a new problem has surfaced and I am therefore posting it as a new question. In the code below, if one fails to enter and amount in say the 'FUELQUANT' field an error is raised and a popup generated. However, if you enter a value, say 13.5 I want it to reflect in the Inbox as 13.50. To do so I want to read the value in the field then format it to 2 decimal places and return it via .update to the Inbox. My problem is that as soon as I put in the formatting code line(s), then if there is no value in the Inbox (i.e when it should cause the popup to activate), I get an error: "could not convert string to float: ' ' " Is there a way around this? I have tried everything that I could find to try to solve the problem but nothing seems to work.
...ANSWER
Answered 2022-Jan-28 at 13:08It is about the programming logic.
Demo code for it
QUESTION
this is probably a really simple question, but I can't seem to find the answer.
But how do I go about changing the date of a tkcalendar calendar without user input?
Right now I am creating a new calendar every time my program loops to certain screen and I feel that this is inefficient.
Example:
Thank you!
...ANSWER
Answered 2022-Jan-19 at 12:49As indicated in the documentation, the Calendar
class has a .selection_set()
method to change the selected date. It takes in argument the date to be selected in the form of a datetime.date
, a datetime.datetime
or a string formated according to the locale used in the calendar.
Example:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install tkcalendar
You can use tkcalendar like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page