How To Create Transparent Digital Watch using wxpython

How To Create Transparent Digital Watch using wxpython
Python Training in Meerut #Author: ManishHacker1

How To Create Transparent Digital Watch Using Python

Hello Guys.. I am Manish. I hope, all of you will be very well. Today, we will be work on Desktop Application Development using WxPython.

WxPython is a most popular python library used for Desktop Application Development. Here, we will create a Transparent Digital Watch with the help of WxPython library. So, first of all we will install WxPython library.

Method 1:

Open your command prompt and type:


---> pip install wxpython 
and press enter button.

Method 2:

Open Google Search Engine and search: Download wxpython 2.7 and click on.. Source:Download


After downloading, we will install wxpython library. Next next next.. ok ok ok…

After installation we will confirm that our wxpython library successfully install or not. So, open our python IDLE interpreter and type:

import wx


If you don’t have got any error message that mean your wxpython library successfully installed in your computer or laptop.
Fine.. Now we will work on our main course. Before working on this project we must knowledge about some python module.

  • Class
  • Object
  • Time
  • Function
  • About constructor
  • Some basic knowledge of wxpython

Now, we are ready to develop our Transparent Digital Watch.

Full Source Code:


 
#Krypsec Digital Watch
#Author: ManishHacker1

import wx
import time

class MyDialog(wx.Dialog):
    def __init__(self, parent, id, title):
        wx.Dialog.__init__(self, parent, id, title, size = (480, 210))
        

        self.Bind(wx.EVT_PAINT, self.OnPaint)
        self.timer = wx.Timer(self)
        self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer)
        self.timer.Start(1000)
        
        

    def Draw(self, dc):
        t = time.localtime(time.time())
        st = time.strftime("%b %d %y,%a \n \t \t \t %I:%M:%S", t)
        dc.SetBackground(wx.GREY_BRUSH)
        self.SetTransparent(225)
        dc.Clear()
        dc.SetFont(wx.Font(50, wx.SWISS, wx.NORMAL, wx.NORMAL))
        
        tw, th = dc.GetTextExtent(st)
        dc.DrawText(st, 20, 20)
       
        
    def OnTimer(self, evt):
        dc = wx.BufferedDC(wx.ClientDC(self))
        self.Draw(dc)

    def OnPaint(self, evt):
        dc = wx.BufferedPaintDC(self)
        self.Draw(dc)

class MyApp(wx.App):
    def OnInit(self):
        dlg = MyDialog(None, -1, 'Krypsec Digital Watch')
        dlg.ShowModal()
        dlg.Destroy()
        return True
 
app = MyApp(0)
app.MainLoop()

Output

Thank You for reading this article. I hope you will have enjoyed read this article.If you want to learn more interesting article. Then subscribe,share and like.Thank you very much for your support and love.

And also like my FB page given below link and share it.

Best Python Training and Ethical Hacking Training in Meerut, Noida , Delhi.

Krypsec Digital Security Provided Python Training
  • Best Python Training in Noida
  • Best Python Training in Delhi
  • Best Python Training in Meerut
  • Best Python Training in India

Source: Python Secret

Source: Python

Follow ManishHacker1

Summary
How To Create Transparent Digital Watch using wxpython
Article Name
How To Create Transparent Digital Watch using wxpython
Description
WxPython is a most popular python library used for Desktop Application Development. Here, we will create a Transparent Digital Watch with the help of WxPython..
Author
Publisher Name
Kryptora
Publisher Logo

Leave a Reply

avatar
  Subscribe  
Notify of

Pin It on Pinterest

Optimization WordPress Plugins & Solutions by W3 EDGE