So, recently I've been experimenting with a telnet server, and a 5250 terminal emutator and I thought of making a field system, for easier graphical (well, not quite) displaying.
This basically lets you set the value of a X and Y position on the screen and it automatically updating it, and I needed to make the field_[X & Y coordinates] variables global in order to use them in all the functions. The screen size variables work fine, but since it has many diffirent field_* variables which have diffirent names, I had to use eval, but this throws a syntax error.
The code and error message is located below: -
from os import system
-
-
def set_screen_size(x,y):
-
global screen_x
-
global screen_y
-
screen_x = str(x)
-
screen_y = str(y)
-
system('mode con cols=' + screen_x + ' lines=' + screen_y)
-
-
def set_field(x,y,val):
-
global screen_x
-
global screen_y
-
x = str(x)
-
y = str(y)
-
val = val[0:1]
-
if(x > screen_x or x < 0 or y > screen_y or x < 0):
-
on_error('Field outside screen given. set_field('+x+','+y+','+val+')')
-
eval('global field_' + x + y)
-
eval('field_' + x + y + ' = ' + val)
-
update_screen()
-
-
def update_screen():
-
global screen_x
-
global screen_y
-
for x in screen_x:
-
line = ""
-
for y in screen_y:
-
eval('global field_' + x + y)
-
eval('val = field_' + x + y)
-
line = line + val
-
print line
-
Traceback: -
Traceback (most recent call last):
-
File "G:\FieldScreen\fieldscreen.py", line 34, in <module>
-
set_field(0,0,"H")
-
File "G:\FieldScreen\fieldscreen.py", line 18, in set_field
-
eval('global field_' + x + y)
-
File "<string>", line 1
-
global field_00
-
^
-
SyntaxError: invalid syntax
-
1 2542
Start with this - if(x > screen_x or x < 0 or y > screen_y or x < 0):
-
if(x > screen_x or x < 0 or y > screen_y or y < 0): <=====
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andrew James |
last post by:
Gentlemen,
I'm running into a problem whilst testing the parsing of a language I've
created with TPG . It seems that for some reason, TPG balks when I try
to parse an expression whose first letter is 't' (or, in fact, at any
time when 't' is at the beginning of a token). This doesn't happen with
any other letter (as far as I know), nor if the 'T' is capitalised.
My grammar looks like this:
|
by: Dermot O'Loughlin |
last post by:
Can anyone help me with this?
I get the following error when using the odbc adapter wizard in VS.Net
2003:
---------------------------
Wizard Form
---------------------------
An unexpected error has occurred.
|
by: FaYYaZ |
last post by:
Hi All
I am getting error "Syntax error " when trying to define a class
Like
Class myClass
Public height
Public ID
Private t_width
|
by: KevLow |
last post by:
Hi,
Hope some kind soul can help me out here..
I'm trying to programmatically modify the column headings of a crosstab
query such that it can be dynamic based on user specified period (Month
Year to Month Year)
So far i have tried to use the following code:
//
|
by: Charlie |
last post by:
Hi:
I get a TreeNode binding error when using Data property of XmlDataSource
control. When I switch to TextFile property and point to xml file on hard
drive, problem goes anyway. I'm initializing Data property with xml string
that matches file exactly. Seems to be problem with binding because if I
remove bindings, tree works both ways. I'm binding on server like so...
TreeNodeBinding bind = new TreeNodeBinding();
bind.DataMember =...
| |
by: Al Santino |
last post by:
Hello,
I've created a simple C# web services project using Visual Studio 2005. My
service compiles and runs correctly when called by remote clients.
I'm able to step through the service in the debugger unless I add a
Global.asax file. When I do that and then try to run the debugger I receive
error 403. If I remove the Global.asax file things work fine. The
Global.asax file is the one generated by VS 2005 - I don't try to add
anything...
|
by: sharmilah |
last post by:
I have the following code in my script and it's giving a syntax error at line *** when using the password function. My password in the mysql database is encrypted using the password function itself and I want to verify the input password against my database password. PLEASE HELP
if (isset($_POST)) $password = @$_POST;
if (($login != "") && ($password != "")) {
$conn = mysql_connect("localhost", "root", "root");
...
|
by: msnews.microsoft.com |
last post by:
Our IT team relocated our application servers yesterday. They had to take
one machine out of the cluster because it would prompt users for credentials
if accessed using the IP address, which I guess is what happens when it is
accessed through the firewall. However, it works as expected when I use the
machine name in place of the IP address.
To summarize, the application servers were moved to a new hosting site and
one machine is...
|
by: svsenthilkumar |
last post by:
Hai,
I got an javascript error when using ajax in mozilla browser, anyone help me why the error is coming, meaning for this error and how can i rectify this error.
Error: " nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: (here url)
|
by: James Watson |
last post by:
'Microsoft VB 6.3, Access 2002
'Syntax error in the INSERT INTO Statement when the query runs
'How can I make this work?
Private Sub Command52_Click()
On Error GoTo Err_Command52_Click
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim rsSQL As DAO.Recordset
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |