Skip to main content

通过PYHACKGUI库,您可以简单地绘制一个HACK界面

Project description

PyHackGUI

一个专为游戏外*界面设计的Python GUI库,基于pygame构建,支持透明窗口、高DPI、中文显示等特性。

特性

  • 专为游戏设计: 支持透明窗口覆盖,适用于游戏辅助工具
  • 高DPI支持: 自动处理Windows高DPI缩放
  • 中文友好: 完美支持中文字体显示
  • 丰富控件: 按钮、滑块、复选框、下拉框、颜色选择器等
  • 全局输入: 支持全局鼠标和键盘事件捕获
  • 易于使用: 简洁的API设计,快速上手

安装

pip install pyhackgui

快速开始

from pyhackgui import PyHackGUI
import time

class MyGUI(PyHackGUI):
    def __init__(self):
        super().__init__("我的游戏界面")
        self.show_menu = True
        
    def draw_content(self):
        # 显示FPS
        super().draw_content()
        
        if self.show_menu:
            # 创建一个面板
            panel = self.panel("main_panel", "主菜单", (50, 50), (300, 400))
            
            if panel['visible'] and not panel.get('minimized'):
                # 在面板内容区域绘制控件
                content = panel['content_rect']
                base_x = content.x // self.dpi_scale
                base_y = content.y // self.dpi_scale
                
                # 按钮示例
                if self.button("btn1", (base_x + 10, base_y + 10), (120, 30), "点击我"):
                    print("按钮被点击了!")
                
                # 滑块示例
                value = getattr(self, 'slider_value', 50.0)
                self.slider_value = self.slider_float("slider1", (base_x + 10, base_y + 50), 
                                                    (150, 20), value, 0.0, 100.0, "值: %.1f")
                
                # 复选框示例
                checked = getattr(self, 'checkbox_state', False)
                self.checkbox_state = self.checkbox("cb1", (base_x + 10, base_y + 80), 
                                                  checked, "启用功能")

if __name__ == "__main__":
    gui = MyGUI()
    gui.run()

主要控件

面板 (Panel)

panel = self.panel("panel_name", "标题", (x, y), (width, height), 
                   movable=True, closable=True, minimizable=True)

按钮 (Button)

if self.button("btn_name", (x, y), (width, height), "按钮文本"):
    # 按钮被点击时的处理
    pass

滑块 (Slider)

value = self.slider_float("slider_name", (x, y), (width, height), 
                         current_value, min_val, max_val, "格式: %.1f")

复选框 (Checkbox)

checked = self.checkbox("cb_name", (x, y), checked_state, "复选框文本")

下拉框 (ComboBox)

selected_index = self.combo("combo_name", (x, y), width, 
                           ["选项1", "选项2", "选项3"], current_index)

颜色选择器 (Color Picker)

color = self.color_picker("color_name", (x, y), (r, g, b, a), with_alpha=True)

文本输入框 (Text Input)

text = self.text_input("input_name", (x, y), (width, height), 
                      placeholder="请输入...", initial="初始值")

绘制功能

基本图形

# 绘制线条
self.draw_line((x1, y1), (x2, y2), (r, g, b, a), width=2)

# 绘制矩形
self.draw_rect((x, y), (width, height), (r, g, b, a), thickness=1)
self.draw_filled_rect((x, y), (width, height), (r, g, b, a))

# 绘制圆形
self.draw_circle((x, y), radius, (r, g, b, a), thickness=1)

# 绘制文本
self.draw_text("文本内容", (x, y), (r, g, b, a), size=16)

游戏专用功能

# ESP方框
self.draw_esp_box((x, y), (width, height), (r, g, b, a), thickness=2)

# 准星
self.draw_crosshair((x, y), size=10, gap=4, thickness=1, (r, g, b, a))

# 射线
self.draw_tracer((target_x, target_y), (r, g, b, a), from_bottom=True)

# FOV圆圈
self.draw_fov_circle((x, y), radius, (r, g, b, a))

# 进度条
self.draw_progress_bar((x, y), (width, height), value, min_val, max_val)

系统要求

  • Python 3.7+
  • Windows 操作系统
  • pygame 2.0.0+
  • pywin32 227+

许可证

MIT License

贡献

欢迎提交Issue和Pull Request!

更新日志

v1.0.0

  • 初始版本发布
  • 支持基本GUI控件
  • 透明窗口覆盖功能
  • 高DPI支持
  • 中文字体支持

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyhackgui-1.0.1.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyhackgui-1.0.1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file pyhackgui-1.0.1.tar.gz.

File metadata

  • Download URL: pyhackgui-1.0.1.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for pyhackgui-1.0.1.tar.gz
Algorithm Hash digest
SHA256 589a479dcae25164f27902b492ce1d4fdc5f27fcde8e984378358c4e2ff716fc
MD5 b24061c00292f45814754459ed7b9948
BLAKE2b-256 8041bb236a9bcc8c8e62573453e2f9e44dfc20713f5855607e974bd41cd9059a

See more details on using hashes here.

File details

Details for the file pyhackgui-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyhackgui-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for pyhackgui-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4f9dd4eeea0d2700890acd75472d3ad79ec94990c5391967630f331d5d9f8992
MD5 ce6db7fce4f997cda07aa5bb061718cd
BLAKE2b-256 c9933b4c88a7beef6006df625dcfbd526d61cde0c5b3c147e0296437434c28dc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page