Now the code queries a database and displays a value when pressing the button. Need to learn how to better arrange the button and text output in the window.  ```python import MySQLdb from tkinter import * from tkinter.ttk import * window =Tk() window.title("Pylearn Day 3") window.geometry('1024x768') lbl = Label(window, text="hello", font=("Arial Bold", 50)) lbl.grid(column=100, row=10) def clicked2(): db = MySQLdb.connect("192.168.1.200", "pidata", "Rasp!data99", "home_data") cursor = db.cursor() sqlcmd = "select max(temp) from temperatures where tempTime like '2019-09-24%';" cursor.execute(sqlcmd) row = cursor.fetchone() lbl.configure(text= "Max Temp " + str(row[0]), font=("Arial Bold", 14)) db.close() button_2 = Button(window, text="Click Me!", command=clicked2) button_2.grid(column=2, row=9) window.mainloop() ```
author | mytechtrail |
---|---|
permlink | teaching-myself-python-day-3 |
category | ulog |
json_metadata | {"app":"steempeak/1.17.0","format":"markdown","tags":["ulog","marlians","palnet","python","stem","ctp"],"image":["https://files.steempeak.com/file/steempeak/mytechtrail/HEtZWklh-pylearn-day3.png"]} |
created | 2019-09-24 20:28:00 |
last_update | 2019-09-24 20:28:00 |
depth | 0 |
children | 4 |
last_payout | 2019-10-01 20:28:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.063 HBD |
curator_payout_value | 0.061 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 961 |
author_reputation | 18,997,364,795,810 |
root_title | "Teaching myself Python Day 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 90,907,619 |
net_rshares | 587,875,171,097 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
doitvoluntarily | 0 | 20,577,885,048 | 100% | ||
anomaly | 0 | 97,114,323 | 1% | ||
eturnerx | 0 | 236,093,257,981 | 32.5% | ||
diverse | 0 | 639,008,970 | 100% | ||
dmxmaster | 0 | 574,457,251 | 100% | ||
solominer | 0 | 18,448,431,603 | 3% | ||
enforcer48 | 0 | 36,988,985,691 | 15% | ||
mrshev | 0 | 75,293,142,254 | 100% | ||
nordal | 0 | 540,817,058 | 100% | ||
sbi7 | 0 | 157,146,525,922 | 88.91% | ||
amir01 | 0 | 415,142,753 | 100% | ||
brendanweinhold | 0 | 134,329,247 | 100% | ||
raspibot | 0 | 324,990,948 | 100% | ||
kendra19 | 0 | 3,262,957,173 | 100% | ||
s77assistant | 0 | 28,029,778,471 | 38.31% | ||
abh12345.stem | 0 | 187,926,829 | 25% | ||
clicktrackprofit | 0 | 6,406,563,424 | 20% | ||
sbi-tokens | 0 | 135,024,712 | 3.72% | ||
ggvoter | 0 | 611,761,308 | 75% | ||
curation.stem | 0 | 747,301,886 | 75% | ||
cryptopassionctp | 0 | 99,596,117 | 40% | ||
stem.alfa | 0 | 481,140,507 | 100% | ||
ctl001 | 0 | 461,382,622 | 100% | ||
stemd | 0 | 177,648,999 | 30% |
@trufflepig
author | mytechtrail |
---|---|
permlink | re-mytechtrail-pyi1b6 |
category | ulog |
json_metadata | {"tags":["ulog"],"app":"steempeak/1.17.1"} |
created | 2019-09-27 16:48:00 |
last_update | 2019-09-27 16:48:00 |
depth | 1 |
children | 0 |
last_payout | 2019-10-04 16:48:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 11 |
author_reputation | 18,997,364,795,810 |
root_title | "Teaching myself Python Day 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 91,004,790 |
net_rshares | 0 |
Hello fellow @mytechtrail Your post was upvoted with **38.31% ($0.0123)** because you are an awesome member of **s77assistant group**. You have earn a **total of $0.7732** so far. keep it up. Together we can achieve our goal and push STEEM to the moon. You can **increase your upvote value** by increasing your **collected points** with one of the following ways: 1. **Delegating** more SP will generate more points per day, 2. **Inviting** other steemians to join our group with !invite(@membername) command, 3. **Transfering** Steem/SBD Don't forget to use **EnhancedSBI** functionality every day and get 3 SBI shares for every 2 STEEM you send with 2for3 memo. ___ At the current time my **full vote worth $0.032** but with your help this can change. Delegating power will increase my vote worth and your reward. [50SP](https://steemconnect.com/sign/delegateVestingShares?delegatee=s77assistant&vesting_shares=50%20SP), [100SP](https://steemconnect.com/sign/delegateVestingShares?delegatee=s77assistant&vesting_shares=100%20SP), [250SP](https://steemconnect.com/sign/delegateVestingShares?delegatee=s77assistant&vesting_shares=250%20SP), [500SP](https://steemconnect.com/sign/delegateVestingShares?delegatee=s77assistant&vesting_shares=500%20SP), [1,000SP](https://steemconnect.com/sign/delegateVestingShares?delegatee=s77assistant&vesting_shares=1000%20SP), [5,000SP](https://steemconnect.com/sign/delegateVestingShares?delegatee=s77assistant&vesting_shares=5000%20SP), [Custom Amount](https://steembottracker.com/delegation.html?delegatee=s77assistant) Make sure you have at least 15 SP left on your account. ___ [Visit](https://steempeak.com/@s77assistant/golden-deals-report-26-09-2019) s77assistant's daily report to stay informed about any news ___ s77assistant now supports his first game. [](https://steemit.com/games/@s77assistant/lucky-numbers-report-2) ___ **[Golden Deals!!!](https://steemit.com/palnet/@s77assistant/golden-deals-report-26-09-2019)** Win amazing rewards including Legendary SteemMonster Cards, SBI Shares and STEEM [](https://steemit.com/palnet/@s77assistant/golden-deals-report-26-09-2019)
author | s77assistant | ||||||
---|---|---|---|---|---|---|---|
permlink | 6exipfsiqpl | ||||||
category | ulog | ||||||
json_metadata | "" | ||||||
created | 2019-09-26 12:05:09 | ||||||
last_update | 2019-09-26 12:05:09 | ||||||
depth | 1 | ||||||
children | 0 | ||||||
last_payout | 2019-10-03 12:05:09 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 0.000 HBD | ||||||
curator_payout_value | 0.000 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 2,345 | ||||||
author_reputation | 12,293,901,128,654 | ||||||
root_title | "Teaching myself Python Day 3" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 90,962,279 | ||||||
net_rshares | 0 |
hmm ... i'm not the python guy but so far when dealing with steem(it) it seems pretty much inevitable ... i havent found any php lib and if its not for parsing w. condenser python seems about the only option other than 'manually' signing ( = lol ) -> https://steemit.com/steem/@xeroc/steem-transaction-signing-in-a-nutshell (in a nutshell as the dude so eloquently states) i dont know what OS tickles your fancy but im prone to l00nix (mint usually, regardless of the front desktop, that depends on the hardware, i find cinnamon the most pleasing but not really fit for my celeron-machines ...) so (not sure if you need this, im sure you didnt ask for it but if you wanna do steem it might help - i find the documentation severely lacking and even the how-to installit on linux didnt work for me as is , so ): <b>installsteem.sh0</b> ``` #!/bin/bash ####################################### sudo apt install -y git git clone https://github.com/steemit/steem-python.git sudo apt install -y python3-dev cd steem-python sudo apt install -y python3-setuptools sudo apt install -y libssl-dev sudo python3 setup.py install ``` did it last time then you can use steempy from the cli ``` steempy ``` or ``` steempy --help ``` ...the usual , for all wallet stuff and voting (following too i think and some other stuff , and <b>pythoncat.py</b> (more like a copy paste adapted from some thing i found somewhere) ``` from steem import Steem from steem.transactionbuilder import TransactionBuilder from steembase import operations import time, random, os def buy_upvote(author,upvote_bot, amount, permlink): transfers =[{ 'from': author, 'to': upvote_bot, 'amount': '{0:.3f} SBD'.format(amount), 'memo': 'https://steemit.com/@{}/{}'.format(author, permlink) }] tb = TransactionBuilder() operation = [operations.Transfer(**x) for x in transfers] tb.appendOps(operation) tb.appendSigner(author, 'active') tb.sign() try: tx = tb.broadcast() print ("Buying vote succes") except Exception as error: print(repr(error)) def submit_post(title, tags, body, author): steemPostingKey = os.environ.get('steemPostingKey') steem = Steem(wif=steemPostingKey) permlink_title = ''.join(e for e in title if e.isalnum()).lower() permlink = "{}-%s%s".format(permlink_title) % (time.strftime("%Y%m%d%H%M%S"), random.randrange(0,9999,1)) try: steem.post(title, body, author, permlink, None, None, None, None, tags, None, False) print ("Submitted post") except Exception as error: print(repr(error)) return permlink def run(): author = 'ubakdhfsdkljhfsdklsti' upvote_bot = 'minnowbooster' amount = 0.05 post = [line.rstrip('\n') for line in open('postbodytext')] title = post[0] tags = post[1] author = post[2] body = '\n'.join(post[3:]) permlink = submit_post(title, tags, body, author) if __name__ == '__main__': run() ``` if found that somewhere else, just mark out the buy an upvote bit and put the postbody in a flatfile (however you want that, typed or pre-generated) and that's good to go and someone pointed me into the direction of custom json this week (which is actually where the real power resides ... and all the bru-ha on communities and smt's is probably nothing more than a 'for the masses' interface to do what was there all along .. musing and steemmonsters , steemstem, drugwars and probably a zound more have been doing that a long time <b>customcenter.py</b> ``` from steem import Steem from steem.transactionbuilder import TransactionBuilder from steembase import operations s = Steem(nodes=["https://api.steemit.com"], keys=["INSERTTHATPOSTINGKEYHERE"]) account = "INSERTYOURACCOUNTNAMEHERE" apythonvariable = "i dont really know howapythonvariable works and what it looks like" #post = [line.rstrip('\n') for line in open('ascithing')] ops = [ operations.CustomJson(**{ "from": account, "id": "dndchar", "json": [ 'my char', { "name": "Von Trappiël", "race": "high elf", "alignment": "chaotic-good", "STATS": "STR:12,DEX:18,CON:10,INT:16:WIS:14,CHA:16", "ETCETERA": "i suppose you can use more brackets im not the json expert", "ETC2": "and stuff", "args": apythonvariable } ], "required_auths": [], "required_posting_auths": ["INSERTYOURACCOUNTNAMEHERE"], }), ] tb = TransactionBuilder() tb.appendOps(ops) tb.appendSigner(account, "posting") tb.sign() tb.broadcast() ``` (to read a file into var you just unmark the #post bit , im sure you know plenty to read the code) i really dont know jack about python lol i never needed it and its only by necessity for lack of php-signing lib which i cant find anywhere (or unix lib for that matter so the heavy layer of python seems unavoidable) should both work if you imported an account keys into steempy with steempy importaccount (i think) the flatfile for posting has title at line 0, tags at line 1 etc ... but since you know base python (probably more than me you can read that im starting to assume like the elder devs do here lol anyway ... maybe it helps with the hobby ... since i just though of it ... i just thought ... if you got any working scripts that do anything steemrelated sure don't mind you leave them in a reply to the only post i have on my feed here (but just as good if you dont, its just fyi) second one has the posting key in it 'naked which i dont really like but its not an actual disaster either ... i hope i didnt leave any of mine in ;- :: funny lulz like custom ascii logos : http://localhost/api_tyr/dc_v1.php euhm yagh make that https://alleycat.be/api_tyr/dc_v1.php (stands for datacenter @gmdatacenter, not disconnection heh) v2 is testing the ways to pack all @goldmanmorgan wallets into one chunk but offline when im not working on it (its just some bedroom leftover pc, not meant for hi traffic) or you could build steemmonsters, i guess, if you had UltiMatt drive & money :D  i always find an example to mess with is worth 20 pages of theory and seven courses by some elite dude who thinks everyone speaks school-kid ... but im just a hobbyist ofcourse ;-))))) right ... im gonna try and remember what i was doing ttyl cu around
author | yapcat |
---|---|
permlink | pz11oj |
category | ulog |
json_metadata | {"tags":["post"],"links":["https://steemit.com/steem/@xeroc/steem-transaction-signing-in-a-nutshell","http://localhost/api_tyr/dc_v1.php","https://alleycat.be/api_tyr/dc_v1.php"],"app":"steemit/0.1","users":["gmdatacenter","goldmanmorgan"],"image":["https://cdn.steemitimages.com/DQmZFstUi5d4V7pfV4i2wStee1t9nMLxLAHDi7TLmCkX6HQ/animated-have-a-nice-day-image-0008.gif"]} |
created | 2019-10-07 23:09:57 |
last_update | 2019-10-07 23:21:18 |
depth | 1 |
children | 1 |
last_payout | 2019-10-14 23:09:57 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 6,608 |
author_reputation | -721,279,119,965 |
root_title | "Teaching myself Python Day 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 0 |
post_id | 91,331,259 |
net_rshares | 24,986,177,727 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
mytechtrail | 0 | 24,986,177,727 | 25% |
Thanks, I will try and leave comment when I get some working Steem related Python code. I agree that looking at some working code is the way I am able to learn new things.
author | mytechtrail |
---|---|
permlink | re-yapcat-pz1313 |
category | ulog |
json_metadata | {"tags":["ulog"],"app":"steempeak/1.17.1"} |
created | 2019-10-07 23:39:42 |
last_update | 2019-10-07 23:39:42 |
depth | 2 |
children | 0 |
last_payout | 2019-10-14 23:39:42 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 172 |
author_reputation | 18,997,364,795,810 |
root_title | "Teaching myself Python Day 3" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 91,331,713 |
net_rshares | 0 |