Logo

dev-resources.site

for different kinds of informations.

.py extension convention

Published at
11/28/2024
Categories
community
tooling
archlinux
oracle
Author
junissen
Author
8 person written this
junissen
open
.py extension convention

Connecting Python libraries is carried out similarly to the standard procedure, be it C/C++:

import sys
import openpyxl
from PyQt5 import QtWidgets
from PyQt5.Qt import QTableWidgetItem
from PyQt5.QtWidgets import (
    QApplication,
    QMainWindow,
    QPushButton,
    QVBoxLayout,
    QWidget,
    QTableWidget,
)
Enter fullscreen mode Exit fullscreen mode

Due to the lack of a Python debugger, it is difficult to verify the correctness of the build and the presence of libraries. The command line (CLI) with operating system prompts is very helpful.

def appication():
    app=QApplication(sys.argv)
    window = QMainWindow()

    window.setWindowTitle("Smart home")
    window.setGeometry(300, 250, 300, 200)

    window.show()
    sys.exit(app.exec_())

if __name__=="__main__":
    appication()
Enter fullscreen mode Exit fullscreen mode

The .py file extension occurs where, when you run the file as a command in the terminal, the builder pulls from your project's location path:

  1. Files that complement the main project, namely libraries and XML describing the graphical/integration structure (Oracle including)
  2. The terminal usually stores the path to the executable file in the computer's system storage, as in ArchLinux. The assembly itself pulls up the necessary libraries if they are standard/you placed them there
  3. As a result, make all the necessary extensions in advance by adding them to the root path
  4. Add the path to the admin's security settings, as the security system sometimes ignores undescribed exceptions explicitly (do it in the settings Path)
lass MainWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.setMinimumWidth(1200)
        self.setMinimumHeight(600)

        layout = QVBoxLayout()

        self.table = QTableWidget(self)
        self.table.setRowCount(4)
        self.table.setColumnCount(4)
        layout.addWidget(self.table)

        btn = QPushButton("Download")
        btn.clicked.connect(self.btn_click)
        layout.addWidget(btn)

        widget = QWidget()
        widget.setLayout(layout)
        self.setCentralWidget(widget)

    def btn_click(self):
        wb = load_workbook('./123.xlsx')

        # Get sheet names
        sheet = wb['Sheet1']
        print(sheet.cell(row=2, column=1).value)
        for row in range(1, 5):
            for column in range(1, 5):
                item = QTableWidgetItem()
                item.setText(str(sheet.cell(row=row, column=column).value))
                self.table.setItem(row-1, column-1, item)

app = QApplication(sys.argv)
window = MainWindow()
window.show()
app.exec()
Enter fullscreen mode Exit fullscreen mode

I don’t really believe in graphical shells for the Python environment; more often than not, they complicate interaction with files. Proper installation of libraries with accompanying conventions makes it easier to interact with the code. The lighter the level and more primitive, the better. Evolution informs reality - not the other way around.

archlinux Article's
30 articles in total
Favicon
GNOME vs KDE Plasma: Which One Is for You?
Favicon
DΓ­a 1/365. Instalar Rust en ArchLinux
Favicon
Git Auto Push
Favicon
Endpoint Security Bypass EXPOSED! Hackers Don't Want You to Know This!
Favicon
Creating a bootable USB flash drive in a GUI application
Favicon
Install and use VirtualBox on Arch Linux & Snigdha OS
Favicon
As a beginner I use Arch, Neovim and code in assembly btw
Favicon
Publishing My First AUR Package: CPIG
Favicon
Como habilitar el "Natural scrolling" en el touchpad en Arch Linux
Favicon
Essential Linux Text Manipulation Tools: cut, sort, uniq, tr πŸ› οΈ
Favicon
Resolving Audio Issues on Arch Linux with Hyprland: A Step-by-Step Guide
Favicon
Shell Scripting for Beginners: Automating Common Coding Tasks
Favicon
Essential Arch Linux Commands: Advanced Mastery(Part-2)[Must Read]
Favicon
Create Your Custom WSL from Any Linux Distribution (Part - 2)
Favicon
How to use Pacman on Arch Linux πŸš€
Favicon
How to Install BlackArch on Top of Arch Linux πŸ–€πŸ§
Favicon
Automate Repetitive Tasks: Creating Bash Scripts for Everyday Use πŸš€
Favicon
Bash Basics: A Beginner’s Guide to Shell Scripting
Favicon
Mastering Arch Linux: A Guide to Installation, Commands, and Mastery(Part-1)[Must Read]
Favicon
Arch Linux Pacman: A Detailed Guide with Commands and Examples 🎩🐧
Favicon
Introducing Snigdha OS: A Fresh Take on Open-Source Operating Systems
Favicon
πŸš€ Arch Linux Cheat Sheet: Essential Commands for new Users
Favicon
.py extension convention
Favicon
Repurposing Your Old Laptop: A Linux-Powered Home Server
Favicon
Step-by-Step Guide to Installing PostgreSQL on Arch Linux
Favicon
Is Linux an Operating System or a Kernel?
Favicon
Installing Arch Linux in UEFI systems(windows)
Favicon
New Rotating Shapes Animation
Favicon
What to do if you accidentally remove the `amd-ucode` package on Arch Linux
Favicon
Holy Trinity?

Featured ones: