[[oktatas:programozás:python:wxpython_gui|< wxPython GUI]]
====== Óra ======
* **Szerző:** Sallai András
* Copyright (c) Sallai András, 2021
* Licenc: [[https://creativecommons.org/licenses/by-sa/4.0/|CC Attribution-Share Alike 4.0 International]]
* Web: https://szit.hu
===== Óra =====
{{:oktatas:programozas:python:wxpython_gui:ora.png?400|}}
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 =====
{{:oktatas:programozas:python:wxpython_gui:ora_keret_nelkul.png?300|}}
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 =====
* https://wxpython.org/Phoenix/docs/html/wx.lib.analogclock.analogclock.AnalogClock.html
* https://wxpython.org/Phoenix/docs/html/wx.NonOwnedWindow.html (2021)