Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

examples: types textinput#3870

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
illume merged 2 commits intomainfromtypes-textinput
May 21, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletionsbuildconfig/stubs/pygame/_common.pyi
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,12 +20,15 @@ Coordinate = Union[Tuple[float, float], Sequence[float], Vector2]
# This typehint is used when a function would return an RGBA tuble
RGBAOutput = Tuple[int, int, int, int]
ColorValue = Union[Color, int, str, Tuple[int, int, int], RGBAOutput, Sequence[int]]
from typing import Union

def my_function(my_var: Union[int, float, complex]) -> None:
print(my_var)
_CanBeRect = Union[
Rect,
Tuple[int,int,int,int],
Tuple[Union[float,int], Union[float,int], Union[float,int], Union[float,int]],
Tuple[Coordinate, Coordinate],
Sequence[int],
Sequence[Union[float,int]],
Sequence[Coordinate],
]

Expand Down
27 changes: 15 additions & 12 deletionsexamples/textinput.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,7 @@
"""
import sys
import os
from typing import List

import pygame
import pygame as pg
Expand All@@ -24,16 +25,19 @@ class TextInput:

# Add font name for each language,
# otherwise some text can't be correctly displayed.
FONT_NAMES = [
"notosanscjktcregular",
"notosansmonocjktcregular",
"notosansregular,",
"microsoftjhengheimicrosoftjhengheiuilight",
"microsoftyaheimicrosoftyaheiuilight",
"msgothicmsuigothicmspgothic",
"msmincho",
"Arial",
]
FONT_NAMES = ",".join(
str(x)
for x in [
"notosanscjktcregular",
"notosansmonocjktcregular",
"notosansregular,",
"microsoftjhengheimicrosoftjhengheiuilight",
"microsoftyaheimicrosoftyaheiuilight",
"msgothicmsuigothicmspgothic",
"msmincho",
"Arial",
]
)

def __init__(
self, prompt: str, pos, screen_dimensions, print_event: bool, text_color="white"
Expand All@@ -50,12 +54,11 @@ def __init__(
self._ime_text_pos = 0
self._ime_editing_text = ""
self._ime_editing_pos = 0
self.chat_list = []
self.chat_list: List[str] = []

# Freetype
# The font name can be a comma separated list
# of font names to search for.
self.FONT_NAMES = ",".join(str(x) for x in self.FONT_NAMES)
self.font = freetype.SysFont(self.FONT_NAMES, 24)
self.font_small = freetype.SysFont(self.FONT_NAMES, 16)
self.text_color = text_color
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp