我在visualstudio中使用ironpython制作了一个非常简单的GUI。你知道吗
一旦我点击按钮,我想看到一个打印“你好世界”。你知道吗
但是,代码不会给出任何打印输出。你知道吗
.py文件:
import wpf
from System.Windows import Application, Window
class MyWindow(Window):
def __init__(self):
self.ui = wpf.LoadComponent(self, 'WpfApplication2.xaml')
def Button_Click(self, sender, e):
print('hello world')
if __name__ == '__main__':
Application().Run(MyWindow())
XAML:
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="WpfApplication2" Height="300" Width="300">
<Grid>
<Button x:Name="Button" Content="Button" HorizontalAlignment="Left" Height="86" Margin="47,68,0,0" VerticalAlignment="Top" Width="184" Click="Button_Click"/>
</Grid>
</Window>
更新:
它只在im不在项目的文件夹中并且我选择构建当前文件时工作。知道为什么吗?
谢谢你。你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐