Skip to content
Snippets Groups Projects
Commit a6d47fd5 authored by Gulilil's avatar Gulilil
Browse files

adding button and components list

parent 02395fa4
Branches comps/button
Tags
2 merge requests!14Fixed minor bug in table,!3Sidebar Icon and Logo
Showing
with 107 additions and 16 deletions
img/RPL Components.png

1.26 MiB

from PyQt6.QtWidgets import QApplication, QWidget
from PyQt6.QtWidgets import QApplication, QWidget
import sys
class Page:
def __init__ (self):
app = QApplication(sys.argv)
window = QWidget()
window.show()
app.exec()
""" Button Components """
from PyQt6.QtWidgets import QPushButton
class Button:
type = None
width = 0
height = 0
xPos = 0
yPos = 0
style = None
text = None
def __init__ (self, parent):
self.type = QPushButton(parent)
# Setter
def resize(self, w, h):
self.width = w
self.height = h
self.type.resize(self.width, self.height)
def setPosition(self, x, y):
self.xPos = x
self.yPos = y
self.type.move(x, y)
def setStyle(self, s):
self.style = s
self.type.setStyleSheet(s)
def setText(self, t):
self.text = t
self.type.setText(t)
# Getter
def getWidth(self):
return self.width
def getHeight(self):
return self.height
def getXPos(self):
return self.xPos
def getYPos(self):
return self.yPos
""" Page Components """
from PyQt6.QtWidgets import QWidget
class Page:
type = None
width = 0
height = 0
def __init__ (self, widget):
self.type = QWidget(widget)
# Setter
def setWidth(self, w, h):
self.width = w
self.height = h
self.type.resize(self.width, self.height)
# Getter
def getWidth(self):
return self.width
def getHeight(self):
return self.height
"""Disuruh ada docstring"""
from PyQt6.QtWidgets import *
import sys
import os
curDir = os.getcwd()
sys.path.append(curDir)
from components.pagination.Page import Page
from components.clickable.Button import Button
class Window(QMainWindow):
type = None
currentPage = 1
def __init__(self):
super().__init__()
# Setting up the app
self.type = QMainWindow()
self.type.resize(1000, 600)
button = Button(self.type)
button.resize(100,50)
button.setText("Click Me!")
button.setStyle("background-color: red; color: #ffffff; border-radius: 10px")
self.type.show()
def test(self, insert):
print(insert)
from src.components.Page import Page
if __name__ == "__main__":
Page()
app = QApplication(sys.argv)
# Starting the app
window = Window()
sys.exit(app.exec())
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment