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.2.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.2-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyhackgui-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 0a810ec4293ef213630100213ffef152cc61b30f98c36c0293564621024e5603
MD5 a205bd376d6bfd632676f6fac321f73b
BLAKE2b-256 1c4077bc8332cf379e57e171b4928d3f785bfbe85be2c73cd3f9a04d2eb788af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyhackgui-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 16b46cf5ebf09220e1d9aa4d69b17cade8324d0164845bbc65ea75b65b33d2a1
MD5 5b9f7c89e80d367de921dfccd3059378
BLAKE2b-256 0a31cda7c4e322ee8a6798dda7e84fc5fc18fe58694cd2138b1e3bc622540766

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