Skip to main content

PyHackGUI - A Python GUI library for game overlay interfaces

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.5.tar.gz (18.9 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.5-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyhackgui-1.0.5.tar.gz
  • Upload date:
  • Size: 18.9 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.5.tar.gz
Algorithm Hash digest
SHA256 c9d161b305fdd546b921d43b3164a069d97856ce4cb9b7d605e244d7777a8aa5
MD5 d1541cabc3754e519bf90aab9dc48b61
BLAKE2b-256 bcc8f56dae6e0e8414b82a6f03e4759e1cd10262385083985934e3a29d4fa182

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyhackgui-1.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 832b4934572ab87678fc2a6a5552814dedd4725c16e7d9e1b309b07da8349b10
MD5 215d6db6d8eac8a5430aaa90440b3522
BLAKE2b-256 9d81d1dd7ae9872fd6da388bffb59a27ac29fc814bcd945720cba7d1300549c9

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