Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

run python script task scheduler

# Create batch file with these commands:


c:\__full_path_to_virtualenv__Scriptsactivate.bat && python __full_path_to_python_script__.py


# && means run command2 if command1 completed successfully.

#Then set that batch file as script to run. 
#You don't need to set any additional arguments in task scheduler (or you can set them in batch file anyway) 
#and can set Start in if script has to read/write from specific directory and uses relative paths. 
Comment

windows task scheduler python script

#------ Windows desktop notifier application using python tkinter -----------------
  from tkinter import *
  from plyer import notification
  from tkinter import messagebox
  from PIL import Image, ImageTk
  import time
  
  t = Tk()
  t.title('Notifier')
  t.geometry("500x300")
  img = Image.open("notify-label.png")
  tkimage = ImageTk.PhotoImage(img)
  
  # get details
  def get_details():
      get_title = title.get()
      get_msg = msg.get()
      get_time = time1.get()
      # print(get_title,get_msg, tt)
  
      if get_title == "" or get_msg == "" or get_time == "":
          messagebox.showerror("Alert", "All fields are required!")
      else:
          int_time = int(float(get_time))
          min_to_sec = int_time * 60
          messagebox.showinfo("notifier set", "set notification ?")
          t.destroy()
          time.sleep(min_to_sec)
  
          notification.notify(title=get_title,
                              message=get_msg,
                              app_name="Notifier",
                              app_icon="ico.ico",
                              toast=True,
                              timeout=10)
  
  img_label = Label(t, image=tkimage).grid()
  
  # Label - Title
  t_label = Label(t, text="Title to Notify",font=("poppins", 10))
  t_label.place(x=12, y=70)
  
  # ENTRY - Title
  title = Entry(t, width="25",font=("poppins", 13))
  title.place(x=123, y=70)
  
  # Label - Message
  m_label = Label(t, text="Display Message", font=("poppins", 10))
  m_label.place(x=12, y=120)
  
  # ENTRY - Message
  msg = Entry(t, width="40", font=("poppins", 13))
  msg.place(x=123,height=30, y=120)
  
  # Label - Time
  time_label = Label(t, text="Set Time", font=("poppins", 10))
  time_label.place(x=12, y=175)
  
  # ENTRY - Time
  time1 = Entry(t, width="5", font=("poppins", 13))
  time1.place(x=123, y=175)
  
  # Label - min
  time_min_label = Label(t, text="min", font=("poppins", 10))
  time_min_label.place(x=175, y=180)
  
  # Button
  but = Button(t, text="SET NOTIFICATION", font=("poppins", 10, "bold"), fg="#ffffff", bg="#528DFF", width=20,
               relief="raised",
               command=get_details)
  but.place(x=170, y=230)
  
  t.resizable(0,0)
  t.mainloop()
Comment

PREVIOUS NEXT
Code Example
Python :: python zip file 
Python :: how to print an index in python 
Python :: python if column is null then 
Python :: powershell bulk rename and add extra string to filename 
Python :: django migrate 
Python :: graphics.py how to make a button 
Python :: python display text in label on new line 
Python :: how to interrupt a loop in python 
Python :: call class function by string python 
Python :: find the median of input number in a list and print 
Python :: python avg 
Python :: Python program to count Even and Odd numbers using while loop in a List 
Python :: structural pattern matching python 
Python :: python 3.7 download 
Python :: ope pickle file 
Python :: python menentukan genap ganjil 
Python :: most occurring element in array python 
Python :: python second element of every tuple in list 
Python :: Openpyxl automatic width 
Python :: datetime time set seconds 
Python :: get values from list of dictionaries python 
Python :: how to set class attributes with kwargs python 
Python :: List Comprehension build a list of tuples 
Python :: 2d array python 
Python :: how to combine number of excel files into a single file using python or pandas 
Python :: how to query DNS records using python 
Python :: python prevent print output 
Python :: .size pandas 
Python :: How to calculate accuracy with two lists in python 
Python :: how to find min, max in dictionaries 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =