我正在为我的小型XNA项目编写一个自定义导入程序,并且我正在尝试做一些简单的事情,就像FileFormatException在我的导入器Import方法中抛出一样.
我已经引用了WindowsBase.dll,所以FileFormatException应该System.IO在IntelliSense中提供,对吧?I型System.IO并没有自动完成与FileFormatException下System.IO.
这是throw语句所在的位置:
namespace TetrominoImporter
{
public class TetrominoReader : ContentImporter<Tetromino>
{
public const string blockFileName = "blocks.txt";
public override Tetromino Import(string filename, ContentImporterContext context)
{
// HERE
Run Code Online (Sandbox Code Playgroud) 我是一个Python菜鸟,所以我可能会在这里遗漏一些东西,但我在程序中如何处理字符串时遇到问题.当我显示它时,只显示第一个字符.
# some code
MessageBox = ctypes.windll.user32.MessageBoxA
# some other code
testString = self.statusBar1.GetStatusText(0)
# displays "azertyu"
MessageBox(None, "azertyu", 'COUCOU', 0)
# displays 'M'
MessageBox(None, testString, 'COUCOU3', 0)
# displays 'a'
MessageBox(None, testString[1:], 'COUCOU3', 0) #
#displays 'c'
MessageBox(None, testString[2:], 'COUCOU3', 0)
Run Code Online (Sandbox Code Playgroud)
完整的字符串是'Machine'(实际上比它长).Python如何认为任何字符都是结尾字符并且一次只显示一个字符?我在这里错过了一些Python基础知识吗?
PS.GetStatusText参考可在http://www.wxpython.org/docs/api/wx.StatusBar-class.html#GetStatusText获得.我用一个很长的字符串测试了GetStatusText,它似乎没有剪切文本.