0

I have a system that creates a file(.csv format) and save and accumulate it into my local drive every 5 minutes automatically.

It contains money transaction for the past 5 minutes.

#This is file format.(output_2020-07-17-21:05)
Sender,Receiver,AMT
BANK1,BANK2,100
BANK3,BANK4,20
BANK1,BANK5,120
...
PIRATE,BANK1,10

My goal is to create alarm system with python when abnormal figures are entered.

For example, if sender column is entered as "Pirate Bank", I want to get an alarm or notification.

Specifically a pop-up window stating that 'A pirates has appeared!'.

I made a code periodically executed including pandas, pd.read_csv....

However I do not know how to creame multiple pop-up.

I did some searches but I couldn't find it.

Some pop-up modules (tkinter,QMessageBox) stop executing code until it ends. When popup window appear, it never execute next step unless I press x button. It means it only pops up sing popup window.

In reality I couldn't press 'x' button in real time.

I just want to create any notification about abnormal situation without my interruption(like clicking x popup button).

It is not necessarily a pop-up.

Notepad, image, anything is fine if it notify me of abnormal situation.

Please give me any good tips.

Thanks for reading.

user3685918
  • 335
  • 2
  • 12
  • See [here](https://stackoverflow.com/questions/459083/how-do-you-run-your-own-code-alongside-tkinters-event-loop) for running your own code alongside tkinter's mainloop – dwb Jul 17 '20 at 13:10

1 Answers1

1

you can open a file with notepad using subprocess.Popen

import subprocess
program_name = "notepad.exe"
file_name = "file.txt"
popen = subprocess.Popen([program_name , file_name])
#if you want to close the process then do:
popen.kill()

in this way you could open any file with a process as you wish (an image for example)

eyalfu
  • 36
  • 4
  • It's useful. Do you know how to close existing "file.txt". Your solution reopen new file even though filename is same as existing opened file. So It would be more helpful if it close existing file. Thanks. – user3685918 Jul 18 '20 at 08:11
  • you have the Popen.kill() method. ill add it to solution – eyalfu Jul 18 '20 at 09:30