我的代码基本上如下:
def foo(param: Literal["a", "b"]) -> None:
...
i = input("A or B?").lower()
assert i in ["a","b"]
foo(i)
但是我抱怨说它不可能知道
Argument 1 to "foo" has incompatible type "str"; expected "Union[Literal['a'], Literal['b
我想在圆圈上写一篇文章。文本和圆圈的交集区域必须是不同的颜色。
一开始我想使用area类,但我不知道如何将文本转换为区域。
我仍然不知道如何将文本转换成形状或其他东西。
下面是示例图片:
void paintComponent(Graphics g){
Ellipse2D myEllipse = new Ellipse2D.Double(20,20,100,100);
//i have no idea how to create a text as a shape.
//if i was able to create a text as a shape,i would name i