Felhasználói eszközök

Eszközök a webhelyen


oktatas:programozas:python:wxpython_gui:ora

Tartalomjegyzék

< wxPython GUI

Óra

Óra

ora.py
import wx
import wx.lib.analogclock.analogclock as ac
 
class MainFrame(wx.Frame):
    def __init__(self, parent):
        super(MainFrame, self).__init__(parent)
        self.clock = ac.AnalogClock(self)        
        self.clock.SetClockStyle(
            ac.SHOW_HOURS_HAND | ac.SHOW_HOURS_TICKS |
            ac.SHOW_MINUTES_HAND |ac.SHOW_SECONDS_HAND|
            ac.SHOW_SHADOWS
            )
        self.clock.SetTickStyle(ac.TICKS_BINARY)
        self.clock.SetTickSize(20)
        self.clock.SetTickFillColour(wx.Colour(0, 0, 80))
        self.clock.SetHandFillColour(wx.Colour(0, 0, 80))
 
 
class ValamiApp(wx.App):
    def OnInit(self):
        frame = MainFrame(None)
        frame.Show()
        return True
 
app=ValamiApp()
app.MainLoop()

Keret nélkül

ora.py
import wx
import wx.lib.analogclock.analogclock as ac
 
class MainFrame(wx.Frame):
    def __init__(self, parent):
        super(MainFrame, self).__init__(parent, style=wx.BORDER_NONE)
 
        self.SetClientSize((300, 300))
        self.SetWindowStyle(wx.FRAME_SHAPED)
 
        size = self.GetClientSize()
        path = wx.GraphicsRenderer.GetDefaultRenderer().CreatePath()
        path.AddCircle(size.x/2, size.y/2, 148)
        self.SetShape(path)
 
        self.clock = ac.AnalogClock(self)        
        self.clock.SetClockStyle(
            ac.SHOW_HOURS_HAND | ac.SHOW_HOURS_TICKS |
            ac.SHOW_MINUTES_HAND |ac.SHOW_SECONDS_HAND|
            ac.SHOW_SHADOWS
            )
        # ~ self.clock.SetTickStyle(ac.TICKS_BINARY)
        self.clock.SetTickStyle(ac.TICKS_DECIMAL)
        self.clock.SetTickSize(20)
        self.clock.SetTickFillColour(wx.Colour(0, 0, 80))
        self.clock.SetHandFillColour(wx.Colour(0, 0, 80))
        self.clock.SetBackgroundColour((0,0,255))
        self.clock.SetHandFillColour((0,0,80))
        self.clock.SetFaceFillColour((255, 255, 255))
        self.clock.SetTickBorderWidth(20)
        self.clock.SetFaceBorderWidth(10)
        self.clock.SetFaceBorderColour((230,230,250))
 
 
class ValamiApp(wx.App):
    def OnInit(self):
        frame = MainFrame(None)
 
        frame.Show()
        return True
 
app=ValamiApp()
app.MainLoop()

Linkek

oktatas/programozas/python/wxpython_gui/ora.txt · Utolsó módosítás: 2021/04/01 09:53 szerkesztette: admin