import os os.environ['SDL_VIDEO_WINDOW_POS'] = str(position[0]) + "," + str(position[1])
в соответствии с http://pygame.org/wiki/FrequentlyAskedQuestions
Вы также можете просто центрировать экран с помощью
import pygame, os os.environ['SDL_VIDEO_CENTERED'] = '1'
Обратите внимание, что это необходимо сделать, прежде чем инициализировать pygame в основном цикле. Я делаю это сразу после импорта os, например. И поскольку они не являются частью pygame, вы, вероятно, можете использовать его в другом месте, хотя такие вещи, как gtk и wxpython, предоставляют свои собственные механизмы.
Use LEFT combined with CHARINDEX:
UPDATE MyTable
SET MyText = LEFT(MyText, CHARINDEX(';', MyText) - 1)
WHERE CHARINDEX(';', MyText) > 0
Note that the WHERE clause skips updating rows in which there is no semicolon.
Here is some code to verify the SQL above works:
declare @MyTable table ([id] int primary key clustered, MyText varchar(100))
insert into @MyTable ([id], MyText)
select 1, 'some text; some more text'
union all select 2, 'text again; even more text'
union all select 3, 'text without a semicolon'
union all select 4, null -- test NULLs
union all select 5, '' -- test empty string
union all select 6, 'test 3 semicolons; second part; third part;'
union all select 7, ';' -- test semicolon by itself
UPDATE @MyTable
SET MyText = LEFT(MyText, CHARINDEX(';', MyText) - 1)
WHERE CHARINDEX(';', MyText) > 0
select * from @MyTable
I get the following results:
id MyText
-- -------------------------
1 some text
2 text again
3 text without a semicolon
4 NULL
5 (empty string)
6 test 3 semicolons
7 (empty string)
Use CHARINDEX
to find the ";". Then use SUBSTRING
to just return the part before the ";".
UPDATE MyTable
SET MyText = SUBSTRING(MyText, 1, CHARINDEX(';', MyText) - 1)
WHERE CHARINDEX(';', MyText) > 0