I wrote a calculator app by using Tkinter. The problem is when I click numbers or operators etc, the whole GUI resized automatically. Actually, I think the width of the label must fix in some way. I tried to use a frame as the parent for the label but it didn’t work. Should I use a different layout mana…
Check the presence of files within directory
under “mypath” i have one folder and under this folder i have files and i want to check the existance of files under this folder, but in my example below it checks only the directory where is the folder (where there is no files) , So any idea? Answer You need to check the right directory: Like @td…
Can you configure key event handling in Qt Designer (PyQt5)?
I just discovered Qt Designer today and it’s rather wonderful. But I’m a keyboard fanatic and don’t want to be forced to use the mouse any more than is strictly necessary, or at the very least I want to have hotkey alternatives to any buttons, etc. This can be coded manually but I was just w…
Setting column to true/false based on comparison of two other columns in pandas?
I have the following dataframe and I want to compare column value and predicted, if they match then I want to set the value of a column “provided” to False. I’m having difficulty doing this. Here’s my data: I want a new column to just have a True/False if value and predicted match. I t…
How to compare 2 different csv files and output the differences without CSV-diff
I have 2 CSVs which are New.csv and Old.csv shown below: New.csv Old.csv If there is a longName (first column) in in the new.csv that is not in the old.csv, I would like that entire new.csv row to be appended to the changes.csv. The current code below is done with csv-diff which seems be a bit glitchy and har…
Run task from another periodic task with celery
I have periodic task which should trigger another task. Final expected behavior: first task should collect some data from external service and then loop over this data (list) and call another task with passing over argument (current iteration in loop). I want to have those tasks in loop being asynchronical. I…
How to generate random number by given string in python?
As hash function gives different values in different python interpreters , Is there a more stable one in python ? Update one: “stable” means that the function should give the same number when the string is same anytime. hash can’t do it . I want a function like : For example , generate_rando…
Progressively filter/smooth a signal in python (to straight line on the left to no filtering on the right)
A picture is worth a thousand words (sorry for the shoddy work): If the solution is preserving the value and the slope at both ends it is better. If, in addition, the position and sharpness of the transition can be adjusted it is perfect. But I have not found any solution yet… Thank you very much for yo…
Datetime Timezones from String
I am trying to figure out how to make a datetime object aware through using a variable. I grab the timezone of the user and pass it through a form to be used. I have tried both of the below methods and am not having much success This will then give me errors of TypeError: tzinfo argument must be None
Python: Creating an object with more than two optional arguments
This works fine, but when I try to initialize a Disease with three optional values, or with the optional value in the middle (ie nicknames), it doesn’t work. Is there any way around these issues? Answer To make a value sometimes optional, you either have to pull it from *labs or **inheritance, or provid…